diff options
author | Marc Laukien <marc@zeroc.com> | 2002-12-14 22:19:03 +0000 |
---|---|---|
committer | Marc Laukien <marc@zeroc.com> | 2002-12-14 22:19:03 +0000 |
commit | a41bb120db0ccdea5eea58e26bd30eddaff40877 (patch) | |
tree | 955f720fb895739a61764d56234ac4a9595a1441 /cpp/src/Ice/CommunicatorI.cpp | |
parent | some fixes (diff) | |
download | ice-a41bb120db0ccdea5eea58e26bd30eddaff40877.tar.bz2 ice-a41bb120db0ccdea5eea58e26bd30eddaff40877.tar.xz ice-a41bb120db0ccdea5eea58e26bd30eddaff40877.zip |
complete shutdown/deactivate re-implementation
Diffstat (limited to 'cpp/src/Ice/CommunicatorI.cpp')
-rw-r--r-- | cpp/src/Ice/CommunicatorI.cpp | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/cpp/src/Ice/CommunicatorI.cpp b/cpp/src/Ice/CommunicatorI.cpp index be71717e327..dc41f2849f2 100644 --- a/cpp/src/Ice/CommunicatorI.cpp +++ b/cpp/src/Ice/CommunicatorI.cpp @@ -37,11 +37,8 @@ Ice::CommunicatorI::destroy() if(!_destroyed) // Don't destroy twice. { _destroyed = true; - - _instance->objectAdapterFactory()->shutdown(); - _instance->destroy(); - _serverThreadPool = 0; + _instance->destroy(); } } @@ -60,14 +57,23 @@ Ice::CommunicatorI::shutdown() void Ice::CommunicatorI::waitForShutdown() { - // - // No mutex locking here, otherwise the communicator is blocked - // while waiting for shutdown. - // - if(_serverThreadPool) + ObjectAdapterFactoryPtr objectAdapterFactory; + { - _serverThreadPool->waitUntilFinished(); + RecMutex::Lock sync(*this); + if(_destroyed) + { + throw CommunicatorDestroyedException(__FILE__, __LINE__); + } + objectAdapterFactory = _instance->objectAdapterFactory(); } + + // + // We must call waitForShutdown on the object adapter factory + // outside the synchronization, otherwise the communicator is + // blocked while we wait for shutdown. + // + objectAdapterFactory->waitForShutdown(); } ObjectPrx @@ -307,8 +313,9 @@ Ice::CommunicatorI::~CommunicatorI() { Warning warn(_instance->logger()); warn << - "The communicator is not the last Ice object that is deleted. (You can\n" - "disable this warning by setting the property `Ice.Warn.Leaks' to 0.)"; + "The communicator is not the last Ice object that is\n" + "deleted. (You can disable this warning by setting the\n" + "property `Ice.Warn.Leaks' to 0.)"; } } } |