diff options
author | Benoit Foucher <benoit@zeroc.com> | 2017-01-25 18:42:10 +0100 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2017-01-25 18:42:10 +0100 |
commit | 524c89c8c5ea8be6d989c855095cf4c58097e654 (patch) | |
tree | 697a384847d23d3d84345b84339f42d63d45687a /cpp/src | |
parent | Fixed ICE-7281 - skipEmptyEncapsulation now checks for the encoding version (diff) | |
download | ice-524c89c8c5ea8be6d989c855095cf4c58097e654.tar.bz2 ice-524c89c8c5ea8be6d989c855095cf4c58097e654.tar.xz ice-524c89c8c5ea8be6d989c855095cf4c58097e654.zip |
First cut of ICE-6920 - Remove try/catch block around communicator destroy
Diffstat (limited to 'cpp/src')
-rw-r--r-- | cpp/src/Glacier2Lib/Application.cpp | 17 | ||||
-rw-r--r-- | cpp/src/Glacier2Lib/SessionHelper.cpp | 26 | ||||
-rw-r--r-- | cpp/src/Ice/Application.cpp | 71 | ||||
-rw-r--r-- | cpp/src/Ice/Service.cpp | 26 | ||||
-rw-r--r-- | cpp/src/IceBox/ServiceManagerI.cpp | 27 | ||||
-rw-r--r-- | cpp/src/IceGrid/Client.cpp | 21 |
6 files changed, 19 insertions, 169 deletions
diff --git a/cpp/src/Glacier2Lib/Application.cpp b/cpp/src/Glacier2Lib/Application.cpp index 3e092e96f95..447ac923430 100644 --- a/cpp/src/Glacier2Lib/Application.cpp +++ b/cpp/src/Glacier2Lib/Application.cpp @@ -340,22 +340,7 @@ Glacier2::Application::doMain(Ice::StringSeq& args, const Ice::InitializationDat if(_communicator) { - try - { - _communicator->destroy(); - } - catch(const Ice::LocalException& ex) - { - Error out(getProcessLogger()); - out << _appName << ": " << ex; - status = 1; - } - catch(const exception& ex) - { - Error out(getProcessLogger()); - out << "unknown exception:\n" << ex; - status = 1; - } + _communicator->destroy(); _communicator = 0; } diff --git a/cpp/src/Glacier2Lib/SessionHelper.cpp b/cpp/src/Glacier2Lib/SessionHelper.cpp index 0e52daeba47..9048320f801 100644 --- a/cpp/src/Glacier2Lib/SessionHelper.cpp +++ b/cpp/src/Glacier2Lib/SessionHelper.cpp @@ -459,14 +459,7 @@ SessionHelperI::destroyInternal(const Ice::DispatcherCallPtr& disconnected) if(communicator) { - try - { - communicator->destroy(); - } - catch(...) - { - } - communicator = ICE_NULLPTR; + communicator->destroy(); } dispatchCallback(disconnected, ICE_NULLPTR); } @@ -482,14 +475,7 @@ SessionHelperI::destroyCommunicator() if(communicator) { - try - { - communicator->destroy(); - } - catch(...) - { - } - communicator = ICE_NULLPTR; + communicator->destroy(); } } @@ -504,13 +490,7 @@ SessionHelperI::connectFailed() if(communicator) { - try - { - communicator->destroy(); - } - catch(...) - { - } + communicator->destroy(); } } diff --git a/cpp/src/Ice/Application.cpp b/cpp/src/Ice/Application.cpp index 976026dfe45..35adba8549c 100644 --- a/cpp/src/Ice/Application.cpp +++ b/cpp/src/Ice/Application.cpp @@ -503,22 +503,7 @@ Ice::Application::doMain(int argc, char* argv[], const InitializationData& initD if(_communicator != 0) { - try - { - _communicator->destroy(); - } - catch(const std::exception& ex) - { - Error out(getProcessLogger()); - out << ex; - status = EXIT_FAILURE; - } - catch(...) - { - Error out(getProcessLogger()); - out << "unknown exception"; - status = EXIT_FAILURE; - } + _communicator->destroy(); _communicator = 0; } @@ -580,31 +565,8 @@ Ice::Application::destroyOnInterruptCallback(int signal) _destroyed = true; } - try - { - assert(_communicator != 0); - _communicator->destroy(); - } - catch(const std::exception& ex) - { - Error out(getProcessLogger()); - out << "(while destroying in response to signal " << signal << "): " << ex; - } - catch(const std::string& msg) - { - Error out(getProcessLogger()); - out << "(while destroying in response to signal " << signal << "): " << msg; - } - catch(const char* msg) - { - Error out(getProcessLogger()); - out << "(while destroying in response to signal " << signal << "): " << msg; - } - catch(...) - { - Error out(getProcessLogger()); - out << "(while destroying in response to signal " << signal << "): unknown exception"; - } + assert(_communicator != 0); + _communicator->destroy(); { Mutex::Lock lock(_mutex); @@ -635,31 +597,8 @@ Ice::Application::shutdownOnInterruptCallback(int signal) _interrupted = true; } - try - { - assert(_communicator != 0); - _communicator->shutdown(); - } - catch(const std::exception& ex) - { - Error out(getProcessLogger()); - out << "(while shutting down in response to signal " << signal << "): std::exception: " << ex; - } - catch(const std::string& msg) - { - Error out(getProcessLogger()); - out << "(while shutting down in response to signal " << signal << "): " << msg; - } - catch(const char* msg) - { - Error out(getProcessLogger()); - out << "(while shutting down in response to signal " << signal << "): " << msg; - } - catch(...) - { - Error out(getProcessLogger()); - out << "(while shutting down in response to signal " << signal << "): unknown exception"; - } + assert(_communicator != 0); + _communicator->shutdown(); { Mutex::Lock lock(_mutex); diff --git a/cpp/src/Ice/Service.cpp b/cpp/src/Ice/Service.cpp index ebbfe4e45c5..58cb55a2d2f 100644 --- a/cpp/src/Ice/Service.cpp +++ b/cpp/src/Ice/Service.cpp @@ -883,13 +883,7 @@ Ice::Service::run(int& argc, char* argv[], const InitializationData& initData) if(_communicator) { - try - { - _communicator->destroy(); - } - catch(...) - { - } + _communicator->destroy(); } return status; @@ -1386,14 +1380,8 @@ Ice::Service::serviceMain(int argc, wchar_t* argv[]) delete[] args; - try - { - assert(_communicator); - _communicator->destroy(); - } - catch(...) - { - } + assert(_communicator); + _communicator->destroy(); terminateService(status); } @@ -1883,13 +1871,7 @@ Ice::Service::runDaemon(int argc, char* argv[], const InitializationData& initDa if(_communicator) { - try - { - _communicator->destroy(); - } - catch(...) - { - } + _communicator->destroy(); } return status; diff --git a/cpp/src/IceBox/ServiceManagerI.cpp b/cpp/src/IceBox/ServiceManagerI.cpp index fdae86be07f..6226b7c0a4d 100644 --- a/cpp/src/IceBox/ServiceManagerI.cpp +++ b/cpp/src/IceBox/ServiceManagerI.cpp @@ -676,7 +676,7 @@ IceBox::ServiceManagerI::start(const string& service, const string& entryPoint, // xlC warns when casting a void* to function pointer # pragma report(disable, "1540-0216") #endif - + SERVICE_FACTORY factory = reinterpret_cast<SERVICE_FACTORY>(sym); try { @@ -860,17 +860,8 @@ IceBox::ServiceManagerI::stopAll() { removeAdminFacets("IceBox.Service." + info.name + "."); - try - { - info.communicator->destroy(); - info.communicator = 0; - } - catch(const Exception& ex) - { - Warning out(_logger); - out << "ServiceManager: exception while stopping service " << info.name << ":\n"; - out << ex; - } + info.communicator->destroy(); + info.communicator = 0; } try @@ -1126,17 +1117,7 @@ IceBox::ServiceManagerI::destroyServiceCommunicator(const string& service, const } removeAdminFacets("IceBox.Service." + service + "."); - - try - { - communicator->destroy(); - } - catch(const Exception& ex) - { - Warning out(_logger); - out << "ServiceManager: exception in shutting down communicator for service " << service << ":\n"; - out << ex; - } + communicator->destroy(); } bool diff --git a/cpp/src/IceGrid/Client.cpp b/cpp/src/IceGrid/Client.cpp index 06326032ea2..6d042c73f45 100644 --- a/cpp/src/IceGrid/Client.cpp +++ b/cpp/src/IceGrid/Client.cpp @@ -354,18 +354,7 @@ Client::main(StringSeq& args) if(_communicator) { - try - { - _communicator->destroy(); - } - catch(const CommunicatorDestroyedException&) - { - } - catch(const Exception& ex) - { - consoleErr << ex << endl; - status = EXIT_FAILURE; - } + _communicator->destroy(); } _ctrlCHandler.setCallback(0); @@ -392,13 +381,7 @@ Client::interrupted() // Otherwise, destroy the communicator. // assert(_communicator); - try - { - _communicator->destroy(); - } - catch(const Exception&) - { - } + _communicator->destroy(); } } |