diff options
author | Marc Laukien <marc@zeroc.com> | 2004-05-05 12:40:44 +0000 |
---|---|---|
committer | Marc Laukien <marc@zeroc.com> | 2004-05-05 12:40:44 +0000 |
commit | b6995322f35c0ec8aaed337845c87f7f6e127c99 (patch) | |
tree | 4f88aebbc04f3c0a371311edde097470c2cdc12e /cpp/src | |
parent | *** empty log message *** (diff) | |
download | ice-b6995322f35c0ec8aaed337845c87f7f6e127c99.tar.bz2 ice-b6995322f35c0ec8aaed337845c87f7f6e127c99.tar.xz ice-b6995322f35c0ec8aaed337845c87f7f6e127c99.zip |
fix in OA::deactivate()
Diffstat (limited to 'cpp/src')
-rw-r--r-- | cpp/src/Ice/ObjectAdapterI.cpp | 48 |
1 files changed, 33 insertions, 15 deletions
diff --git a/cpp/src/Ice/ObjectAdapterI.cpp b/cpp/src/Ice/ObjectAdapterI.cpp index 769a33e907b..c9382303b0e 100644 --- a/cpp/src/Ice/ObjectAdapterI.cpp +++ b/cpp/src/Ice/ObjectAdapterI.cpp @@ -189,25 +189,43 @@ Ice::ObjectAdapterI::waitForHold() void Ice::ObjectAdapterI::deactivate() { - IceUtil::Monitor<IceUtil::RecMutex>::Lock sync(*this); + vector<IncomingConnectionFactoryPtr> incomingConnectionFactories; + OutgoingConnectionFactoryPtr outgoingConnectionFactory; + + { + IceUtil::Monitor<IceUtil::RecMutex>::Lock sync(*this); + + // + // Ignore deactivation requests if the object adapter has already + // been deactivated. + // + if(_deactivated) + { + return; + } + + incomingConnectionFactories = _incomingConnectionFactories; + outgoingConnectionFactory = _instance->outgoingConnectionFactory(); + _deactivated = true; + + notifyAll(); + } + // - // Ignore deactivation requests if the object adapter has already - // been deactivated. + // Must be called outside the thread synchronization, because + // Connection::destroy() might block when sending a CloseConnection + // message. // - if(_deactivated) - { - return; - } - - for_each(_incomingConnectionFactories.begin(), _incomingConnectionFactories.end(), + for_each(incomingConnectionFactories.begin(), incomingConnectionFactories.end(), Ice::voidMemFun(&IncomingConnectionFactory::destroy)); - _instance->outgoingConnectionFactory()->removeAdapter(this); - - _deactivated = true; - - notifyAll(); + // + // Must be called outside the thread synchronization, because + // changing the object adapter might block if there are still + // requests being dispatched. + // + outgoingConnectionFactory->removeAdapter(this); } void @@ -559,7 +577,7 @@ Ice::ObjectAdapterI::getIncomingConnections() const void Ice::ObjectAdapterI::flushBatchRequests() { - std::vector<IceInternal::IncomingConnectionFactoryPtr> f; + vector<IncomingConnectionFactoryPtr> f; { IceUtil::Monitor<IceUtil::RecMutex>::Lock sync(*this); f = _incomingConnectionFactories; |