summaryrefslogtreecommitdiff
path: root/cpp/src/Ice/Service.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src/Ice/Service.cpp')
-rwxr-xr-xcpp/src/Ice/Service.cpp38
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);
}