summaryrefslogtreecommitdiff
path: root/cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp')
-rw-r--r--cpp/src/IceGrid/AdminSessionI.cpp43
-rw-r--r--cpp/src/IceGrid/AdminSessionI.h16
-rw-r--r--cpp/src/IceGrid/RegistryI.cpp6
3 files changed, 34 insertions, 31 deletions
diff --git a/cpp/src/IceGrid/AdminSessionI.cpp b/cpp/src/IceGrid/AdminSessionI.cpp
index b2515e092c6..1e31dd4f7e5 100644
--- a/cpp/src/IceGrid/AdminSessionI.cpp
+++ b/cpp/src/IceGrid/AdminSessionI.cpp
@@ -18,8 +18,8 @@ AdminSessionI::AdminSessionI(const string& userId,
const DatabasePtr& database,
const Ice::ObjectAdapterPtr& adapter,
const WaitQueuePtr& waitQueue,
- RegistryObserverTopic& registryObserverTopic,
- NodeObserverTopic& nodeObserverTopic,
+ const RegistryObserverTopicPtr& registryObserverTopic,
+ const NodeObserverTopicPtr& nodeObserverTopic,
int timeout) :
SessionI(userId, "admin", database, adapter, waitQueue, timeout),
_updating(false),
@@ -64,19 +64,19 @@ AdminSessionI::setObservers(const RegistryObserverPrx& registryObserver,
{
if(_registryObserver)
{
- _registryObserverTopic.unsubscribe(_registryObserver);
+ _registryObserverTopic->unsubscribe(_registryObserver);
}
_registryObserver = RegistryObserverPrx::uncheckedCast(registryObserver->ice_timeout(_timeout * 1000));
- _registryObserverTopic.subscribe(_registryObserver);
+ _registryObserverTopic->subscribe(_registryObserver);
}
if(nodeObserver)
{
if(_nodeObserver)
{
- _nodeObserverTopic.unsubscribe(_nodeObserver);
+ _nodeObserverTopic->unsubscribe(_nodeObserver);
}
_nodeObserver = NodeObserverPrx::uncheckedCast(nodeObserver->ice_timeout(_timeout * 1000));
- _nodeObserverTopic.subscribe(_nodeObserver);
+ _nodeObserverTopic->subscribe(_nodeObserver);
}
}
@@ -100,19 +100,19 @@ AdminSessionI::setObserversByIdentity(const Ice::Identity& registryObserver,
{
if(_registryObserver)
{
- _registryObserverTopic.unsubscribe(_registryObserver);
+ _registryObserverTopic->unsubscribe(_registryObserver);
}
_registryObserver = RegistryObserverPrx::uncheckedCast(current.con->createProxy(registryObserver));
- _registryObserverTopic.subscribe(_registryObserver);
+ _registryObserverTopic->subscribe(_registryObserver);
}
if(!nodeObserver.name.empty())
{
if(_nodeObserver)
{
- _nodeObserverTopic.unsubscribe(_nodeObserver);
+ _nodeObserverTopic->unsubscribe(_nodeObserver);
}
_nodeObserver = NodeObserverPrx::uncheckedCast(current.con->createProxy(nodeObserver));
- _nodeObserverTopic.subscribe(_nodeObserver);
+ _nodeObserverTopic->subscribe(_nodeObserver);
}
}
@@ -237,20 +237,23 @@ AdminSessionI::destroy(const Ice::Current& current)
//
// Unsubscribe from the topics.
//
- if(_registryObserver) // Immutable once _destroy = true
+ if(current.adapter) // Not shutting down
{
- _registryObserverTopic.unsubscribe(_registryObserver);
- _registryObserver = 0;
- }
- if(_nodeObserver)
- {
- _nodeObserverTopic.unsubscribe(_nodeObserver);
- _nodeObserver = 0;
+ if(_registryObserver) // Immutable once _destroy = true
+ {
+ _registryObserverTopic->unsubscribe(_registryObserver);
+ _registryObserver = 0;
+ }
+ if(_nodeObserver)
+ {
+ _nodeObserverTopic->unsubscribe(_nodeObserver);
+ _nodeObserver = 0;
+ }
}
}
-AdminSessionManagerI::AdminSessionManagerI(RegistryObserverTopic& regTopic,
- NodeObserverTopic& nodeTopic,
+AdminSessionManagerI::AdminSessionManagerI(const RegistryObserverTopicPtr& regTopic,
+ const NodeObserverTopicPtr& nodeTopic,
const DatabasePtr& database,
const ReapThreadPtr& reaper,
const WaitQueuePtr& waitQueue,
diff --git a/cpp/src/IceGrid/AdminSessionI.h b/cpp/src/IceGrid/AdminSessionI.h
index 37e9ecf9797..52d6f558ed3 100644
--- a/cpp/src/IceGrid/AdminSessionI.h
+++ b/cpp/src/IceGrid/AdminSessionI.h
@@ -21,7 +21,7 @@ class AdminSessionI : public SessionI, public AdminSession
public:
AdminSessionI(const std::string&, const DatabasePtr&, const Ice::ObjectAdapterPtr&, const WaitQueuePtr&,
- RegistryObserverTopic&, NodeObserverTopic&, int);
+ const RegistryObserverTopicPtr&, const NodeObserverTopicPtr&, int);
virtual ~AdminSessionI();
virtual AdminPrx getAdmin(const Ice::Current&) const;
@@ -44,8 +44,8 @@ protected:
private:
- RegistryObserverTopic& _registryObserverTopic;
- NodeObserverTopic& _nodeObserverTopic;
+ const RegistryObserverTopicPtr _registryObserverTopic;
+ const NodeObserverTopicPtr _nodeObserverTopic;
RegistryObserverPrx _registryObserver;
NodeObserverPrx _nodeObserver;
@@ -55,16 +55,16 @@ class AdminSessionManagerI : virtual public SessionManager
{
public:
- AdminSessionManagerI(RegistryObserverTopic&, NodeObserverTopic&, const DatabasePtr&, const ReapThreadPtr&,
- const WaitQueuePtr&, int);
+ AdminSessionManagerI(const RegistryObserverTopicPtr& , const NodeObserverTopicPtr&, const DatabasePtr&,
+ const ReapThreadPtr&, const WaitQueuePtr&, int);
virtual Glacier2::SessionPrx create(const std::string&, const Glacier2::SessionControlPrx&, const Ice::Current&);
virtual SessionPrx createLocalSession(const std::string&, const Ice::Current&);
private:
-
- RegistryObserverTopic& _registryObserverTopic;
- NodeObserverTopic& _nodeObserverTopic;
+
+ const RegistryObserverTopicPtr _registryObserverTopic;
+ const NodeObserverTopicPtr _nodeObserverTopic;
const DatabasePtr _database;
const ReapThreadPtr _reaper;
const WaitQueuePtr _waitQueue;
diff --git a/cpp/src/IceGrid/RegistryI.cpp b/cpp/src/IceGrid/RegistryI.cpp
index 71a1e2ef606..4f63ba0d8af 100644
--- a/cpp/src/IceGrid/RegistryI.cpp
+++ b/cpp/src/IceGrid/RegistryI.cpp
@@ -263,10 +263,10 @@ RegistryI::start(bool nowarn)
_communicator->stringToIdentity(instanceName + "/TopicManager"),
"Registry");
- NodeObserverTopic* nodeTopic = new NodeObserverTopic(_iceStorm->getTopicManager());
+ NodeObserverTopicPtr nodeTopic = new NodeObserverTopic(_iceStorm->getTopicManager());
_nodeObserver = NodeObserverPrx::uncheckedCast(registryAdapter->addWithUUID(nodeTopic));
- RegistryObserverTopic* regTopic = new RegistryObserverTopic(_iceStorm->getTopicManager());
+ RegistryObserverTopicPtr regTopic = new RegistryObserverTopic(_iceStorm->getTopicManager());
_registryObserver = RegistryObserverPrx::uncheckedCast(registryAdapter->addWithUUID(regTopic));
_database->setObservers(_registryObserver, _nodeObserver);
@@ -286,7 +286,7 @@ RegistryI::start(bool nowarn)
Identity admSessionMgrId = _communicator->stringToIdentity(instanceName + "/AdminSessionManager");
ObjectPtr admSessionMgr =
- new AdminSessionManagerI(*regTopic, *nodeTopic, _database, clientReaper, _waitQueue, sessionTimeout);
+ new AdminSessionManagerI(regTopic, nodeTopic, _database, clientReaper, _waitQueue, sessionTimeout);
adminAdapter->add(admSessionMgr, admSessionMgrId);
//