From 6f99bac58a16e55487b98ddb5d6f837574c55b02 Mon Sep 17 00:00:00 2001 From: Benoit Foucher Date: Mon, 30 Jan 2012 16:51:24 +0100 Subject: Fixed ICE-4772, IceGrid server disable patch for Cengage --- cpp/src/IceGrid/ServerAdapterI.cpp | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'cpp/src/IceGrid/ServerAdapterI.cpp') diff --git a/cpp/src/IceGrid/ServerAdapterI.cpp b/cpp/src/IceGrid/ServerAdapterI.cpp index 814a2f283e2..4c4122ac2ca 100644 --- a/cpp/src/IceGrid/ServerAdapterI.cpp +++ b/cpp/src/IceGrid/ServerAdapterI.cpp @@ -20,12 +20,14 @@ ServerAdapterI::ServerAdapterI(const NodeIPtr& node, ServerI* server, const string& serverName, const AdapterPrx& proxy, - const string& id) : + const string& id, + bool enabled) : _node(node), _this(proxy), _serverId(serverName), _id(id), - _server(server) + _server(server), + _enabled(enabled) { } @@ -39,7 +41,7 @@ ServerAdapterI::activate_async(const AMD_Adapter_activatePtr& cb, const Ice::Cur { { Lock sync(*this); - if(_proxy) + if(_enabled && _proxy) { // // Return the adapter direct proxy. @@ -53,7 +55,7 @@ ServerAdapterI::activate_async(const AMD_Adapter_activatePtr& cb, const Ice::Cur // Nothing else waits for this adapter so we must make sure that this // adapter if still activatable. // - if(!_server->isAdapterActivatable(_id)) + if(!_enabled || !_server->isAdapterActivatable(_id)) { cb->ice_response(0); return; @@ -113,14 +115,14 @@ ServerAdapterI::getDirectProxy(const Ice::Current& current) const // Return the adapter direct proxy if it's set. Otherwise, throw. The caller can eventually // activate the adapter if it's activatable. // - if(_proxy) + if(_proxy && _enabled) { return _proxy; } else { AdapterNotActiveException ex; - ex.activatable = _server->isAdapterActivatable(_id); + ex.activatable = _enabled && _server->isAdapterActivatable(_id); throw ex; } } @@ -205,6 +207,13 @@ ServerAdapterI::destroy() } } +void +ServerAdapterI::updateEnabled() +{ + Lock sync(*this); + _enabled = _server->isEnabled(); +} + void ServerAdapterI::clear() { -- cgit v1.2.3