diff options
author | Benoit Foucher <benoit@zeroc.com> | 2006-11-23 14:44:51 +0000 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2006-11-23 14:44:51 +0000 |
commit | ad476fdda5c9a9f23b9e65fc3c4b3016f7704848 (patch) | |
tree | 329b46efefd33095fe3ed8dc92ef3d8726cd0857 /cpp/src/IceGrid/NodeSessionManager.cpp | |
parent | Remove deprecated methods (diff) | |
download | ice-ad476fdda5c9a9f23b9e65fc3c4b3016f7704848.tar.bz2 ice-ad476fdda5c9a9f23b9e65fc3c4b3016f7704848.tar.xz ice-ad476fdda5c9a9f23b9e65fc3c4b3016f7704848.zip |
Code cleanup and fixed startup scalability issue of the registry (it no
longer contacts all the nodes).
Diffstat (limited to 'cpp/src/IceGrid/NodeSessionManager.cpp')
-rw-r--r-- | cpp/src/IceGrid/NodeSessionManager.cpp | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/cpp/src/IceGrid/NodeSessionManager.cpp b/cpp/src/IceGrid/NodeSessionManager.cpp index 1bef61986af..69485d3cdee 100644 --- a/cpp/src/IceGrid/NodeSessionManager.cpp +++ b/cpp/src/IceGrid/NodeSessionManager.cpp @@ -253,13 +253,13 @@ NodeSessionManager::create(const InternalRegistryPrx& replica) if(replica->ice_getIdentity() == _master->ice_getIdentity()) { thread = _thread; + thread->setRegistry(replica); + thread->tryCreateSession(); } else { - thread = replicaAdded(replica); + replicaAdded(replica, true); } - thread->setRegistry(replica); - thread->tryCreateSession(); } bool @@ -301,27 +301,30 @@ NodeSessionManager::destroy() } } -NodeSessionKeepAliveThreadPtr -NodeSessionManager::replicaAdded(const InternalRegistryPrx& replica) +void +NodeSessionManager::replicaAdded(const InternalRegistryPrx& replica, bool waitTryCreateSession) { Lock sync(*this); if(_destroyed) { - return 0; + return; } ++_serial; NodeSessionMap::const_iterator p = _sessions.find(replica->ice_getIdentity()); + NodeSessionKeepAliveThreadPtr thread; if(p != _sessions.end()) { - return p->second; + thread = p->second; + thread->setRegistry(replica); } - - NodeSessionKeepAliveThreadPtr thread = new NodeSessionKeepAliveThread(replica, _node, _queryObjects); - _sessions.insert(make_pair(replica->ice_getIdentity(), thread)); - thread->start(); - thread->tryCreateSession(false); - return thread; + else + { + thread = new NodeSessionKeepAliveThread(replica, _node, _queryObjects); + _sessions.insert(make_pair(replica->ice_getIdentity(), thread)); + thread->start(); + } + thread->tryCreateSession(waitTryCreateSession); } void |