summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cpp/src/IceGrid/ServerAdapterI.cpp17
-rw-r--r--cpp/src/IceGrid/ServerAdapterI.h1
2 files changed, 15 insertions, 3 deletions
diff --git a/cpp/src/IceGrid/ServerAdapterI.cpp b/cpp/src/IceGrid/ServerAdapterI.cpp
index 85023b27a3d..b6835e6d90f 100644
--- a/cpp/src/IceGrid/ServerAdapterI.cpp
+++ b/cpp/src/IceGrid/ServerAdapterI.cpp
@@ -70,6 +70,7 @@ ServerAdapterI::activate_async(const AMD_Adapter_activatePtr& cb, const Ice::Cur
{
return;
}
+ _activateAfterDeactivating = _server->getState() >= Deactivating;
}
//
@@ -141,11 +142,20 @@ ServerAdapterI::setDirectProxy(const Ice::ObjectPrx& prx, const Ice::Current&)
bool updated = _proxy != prx;
_proxy = prx;
- for(vector<AMD_Adapter_activatePtr>::const_iterator p = _activateCB.begin(); p != _activateCB.end(); ++p)
+ //
+ // If the server is being deactivated and the activation callback
+ // was added during the deactivation, we don't send the response
+ // now. The server is going to be activated again and the adapter
+ // activated.
+ //
+ if(_server->getState() < Deactivating || !_activateAfterDeactivating)
{
- (*p)->ice_response(_proxy);
+ for(vector<AMD_Adapter_activatePtr>::const_iterator p = _activateCB.begin(); p != _activateCB.end(); ++p)
+ {
+ (*p)->ice_response(_proxy);
+ }
+ _activateCB.clear();
}
- _activateCB.clear();
if(updated)
{
@@ -186,6 +196,7 @@ ServerAdapterI::clear()
{
Lock sync(*this);
_proxy = 0;
+ _activateAfterDeactivating = false;
}
void
diff --git a/cpp/src/IceGrid/ServerAdapterI.h b/cpp/src/IceGrid/ServerAdapterI.h
index 50bbedd6854..c8cd68e5d0f 100644
--- a/cpp/src/IceGrid/ServerAdapterI.h
+++ b/cpp/src/IceGrid/ServerAdapterI.h
@@ -48,6 +48,7 @@ private:
Ice::ObjectPrx _proxy;
std::vector<AMD_Adapter_activatePtr> _activateCB;
+ bool _activateAfterDeactivating;
};
typedef IceUtil::Handle<ServerAdapterI> ServerAdapterIPtr;