diff options
author | Benoit Foucher <benoit@zeroc.com> | 2005-05-11 15:33:51 +0000 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2005-05-11 15:33:51 +0000 |
commit | 6cfcf924e6252e6fe129b4f6bbcbd47d7727378c (patch) | |
tree | 8c8c7ffa31cf96550b1dc2c49c925fc4a037c88a /cpp/src/Ice/Service.cpp | |
parent | Fix (diff) | |
download | ice-6cfcf924e6252e6fe129b4f6bbcbd47d7727378c.tar.bz2 ice-6cfcf924e6252e6fe129b4f6bbcbd47d7727378c.tar.xz ice-6cfcf924e6252e6fe129b4f6bbcbd47d7727378c.zip |
Fixed Ice::Service::shutdown() to catch exceptions.
Diffstat (limited to 'cpp/src/Ice/Service.cpp')
-rwxr-xr-x | cpp/src/Ice/Service.cpp | 38 |
1 files changed, 27 insertions, 11 deletions
diff --git a/cpp/src/Ice/Service.cpp b/cpp/src/Ice/Service.cpp index d02f7050c86..fc4d4647e92 100755 --- a/cpp/src/Ice/Service.cpp +++ b/cpp/src/Ice/Service.cpp @@ -119,7 +119,23 @@ Ice::Service::shutdown() { if(_communicator) { - _communicator->shutdown(); + try + { + _communicator->shutdown(); + } + catch(const CommunicatorDestroyedException&) + { + // + // Expected if the service communicator is being + // destroyed. + // + } + catch(const Ice::Exception& ex) + { + ostringstream ostr; + ostr << "exception during shutdown:\n" << ex; + warning(ostr.str()); + } } return true; } @@ -460,25 +476,25 @@ Ice::Service::run(int& argc, char* argv[]) catch(const IceUtil::Exception& ex) { ostringstream ostr; - ostr << "service caught unhandled Ice exception:" << endl << ex; + ostr << "service caught unhandled Ice exception:\n" << ex; error(ostr.str()); } catch(const std::exception& ex) { ostringstream ostr; - ostr << "service caught unhandled std::exception:" << endl << ex.what(); + ostr << "service caught unhandled std::exception:\n" << ex.what(); error(ostr.str()); } catch(const std::string& msg) { ostringstream ostr; - ostr << "service caught unhandled exception:" << endl << msg; + ostr << "service caught unhandled exception:\n" << msg; error(ostr.str()); } catch(const char* msg) { ostringstream ostr; - ostr << "service caught unhandled exception:" << endl << msg; + ostr << "service caught unhandled exception:\n" << msg; error(ostr.str()); } catch(...) @@ -1186,7 +1202,7 @@ Ice::Service::serviceMain(int argc, char* argv[]) catch(const IceUtil::Exception& ex) { ostringstream ostr; - ostr << "service caught unhandled Ice exception:" << endl << ex; + ostr << "service caught unhandled Ice exception:\n" << ex; error(ostr.str()); } catch(...) @@ -1331,7 +1347,7 @@ Ice::Service::runDaemon(int argc, char* argv[]) continue; } - cerr << argv[0] << ": " << strerror(errno) << endl << flush; + cerr << argv[0] << ": " << strerror(errno) << endl; _exit(EXIT_FAILURE); } break; @@ -1354,8 +1370,8 @@ Ice::Service::runDaemon(int argc, char* argv[]) continue; } - cerr << argv[0] << ": I/O error while reading error message from child:" << endl - << strerror(errno) << endl << flush; + cerr << argv[0] << ": I/O error while reading error message from child:\n" + << strerror(errno) << endl; _exit(EXIT_FAILURE); } pos += n; @@ -1366,7 +1382,7 @@ Ice::Service::runDaemon(int argc, char* argv[]) { cerr << ':' << endl << msg; } - cerr << endl << flush; + cerr << endl; _exit(EXIT_FAILURE); } @@ -1563,7 +1579,7 @@ Ice::Service::runDaemon(int argc, char* argv[]) catch(const IceUtil::Exception& ex) { ostringstream ostr; - ostr << "service caught unhandled Ice exception:" << endl << ex; + ostr << "service caught unhandled Ice exception:\n" << ex; errMsg = ostr.str(); error(errMsg); } |