diff options
author | Benoit Foucher <benoit@zeroc.com> | 2006-11-10 14:34:52 +0000 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2006-11-10 14:34:52 +0000 |
commit | d8480f31455c708d0072a8d1a6a28f4b19bd647e (patch) | |
tree | 6d282b3fe4bf9ce7fe08c6da6b728f1f9912d76f /cpp/src/IceGrid/Activator.cpp | |
parent | Filter out IPv6 addresses in getLocalHosts (diff) | |
download | ice-d8480f31455c708d0072a8d1a6a28f4b19bd647e.tar.bz2 ice-d8480f31455c708d0072a8d1a6a28f4b19bd647e.tar.xz ice-d8480f31455c708d0072a8d1a6a28f4b19bd647e.zip |
Memory leak fixes
Diffstat (limited to 'cpp/src/IceGrid/Activator.cpp')
-rw-r--r-- | cpp/src/IceGrid/Activator.cpp | 74 |
1 files changed, 31 insertions, 43 deletions
diff --git a/cpp/src/IceGrid/Activator.cpp b/cpp/src/IceGrid/Activator.cpp index 4e8151d8014..62dd2c6920f 100644 --- a/cpp/src/IceGrid/Activator.cpp +++ b/cpp/src/IceGrid/Activator.cpp @@ -989,15 +989,43 @@ Activator::shutdown() void Activator::destroy() { + map<string, Process> processes; { IceUtil::Monitor< IceUtil::Mutex>::Lock sync(*this); assert(_deactivating); + processes = _processes; } // - // Deactivate all the processes. + // Stop all active processes. // - deactivateAll(); + for(map<string, Process>::iterator p = processes.begin(); p != processes.end(); ++p) + { + // + // Stop the server. The listener thread should detect the + // process deactivation and remove it from the activator's + // list of active processes. + // + try + { + p->second.server->stop_async(0); + } + catch(const ServerStopException&) + { + // Server already stopped or destroyed. + } + catch(const ObjectNotExistException&) + { + // + // Expected if the server was in the process of being destroyed. + // + } + catch(const Ice::LocalException& ex) + { + Ice::Warning out(_traceLevels->logger); + out << "unexpected exception raised by server `" << p->first << "' stop:\n" << ex; + } + } // // Join the termination listener thread. This thread terminates @@ -1006,6 +1034,7 @@ Activator::destroy() // _thread->getThreadControl().join(); _thread = 0; + assert(_processes.empty()); } void @@ -1032,47 +1061,6 @@ Activator::runTerminationListener() } void -Activator::deactivateAll() -{ - // - // Stop all active processes. - // - map<string, Process> processes; - { - IceUtil::Monitor< IceUtil::Mutex>::Lock sync(*this); - processes = _processes; - } - - for(map<string, Process>::iterator p = processes.begin(); p != processes.end(); ++p) - { - // - // Stop the server. The listener thread should detect the - // process deactivation and remove it from the activator's - // list of active processes. - // - try - { - p->second.server->stop_async(0); - } - catch(const ServerStopException&) - { - // Server already stopped or destroyed. - } - catch(const ObjectNotExistException&) - { - // - // Expected if the server was in the process of being destroyed. - // - } - catch(const Ice::LocalException& ex) - { - Ice::Warning out(_traceLevels->logger); - out << "unexpected exception raised by server `" << p->first << "' stop:\n" << ex; - } - } -} - -void Activator::terminationListener() { #ifdef _WIN32 |