diff options
-rw-r--r-- | cpp/src/IceGrid/NodeCache.cpp | 29 | ||||
-rw-r--r-- | cpp/src/IceGrid/NodeSessionI.cpp | 5 | ||||
-rw-r--r-- | cpp/src/IceGrid/RegistryI.cpp | 10 | ||||
-rw-r--r-- | cpp/src/IceGrid/ReplicaSessionI.cpp | 3 | ||||
-rw-r--r-- | cpp/src/IceGrid/SessionManager.h | 3 |
5 files changed, 30 insertions, 20 deletions
diff --git a/cpp/src/IceGrid/NodeCache.cpp b/cpp/src/IceGrid/NodeCache.cpp index 9b9e798aa5f..69fdd9e98e3 100644 --- a/cpp/src/IceGrid/NodeCache.cpp +++ b/cpp/src/IceGrid/NodeCache.cpp @@ -84,7 +84,7 @@ public: Ice::Trace out(_traceLevels->logger, _traceLevels->serverCat); out << "couldn't load `" << _id << "' on node `" << _node << "':\n" << ex; } - + ostringstream os; os << ex; _server->exception(NodeUnreachableException(_node, os.str())); @@ -290,26 +290,25 @@ NodeEntry::setSession(const NodeSessionIPtr& session) sync.acquire(); } } + + // + // Clear the saved proxy, the node has established a session + // so we won't need anymore to try to register it with this + // registry. + // + _proxy = 0; } - else if(!session && !_session) - { - return; - } - - if(!session && _session) + else { + if(!_session) + { + return; + } } _session = session; notifyAll(); - // - // Clear the saved proxy, the node has established a session - // so we won't need anymore to try to register it with this - // registry. - // - _proxy = 0; - if(_registering) { _registering = false; @@ -636,13 +635,13 @@ NodeEntry::checkSession() const out << "creating node `" << _name << "' session"; } - NodeEntry* self = const_cast<NodeEntry*>(this); // // NOTE: setting _registering to true must be done before the // call otherwise if the callback is call immediately we'll // hang in the while loop. // _registering = true; + NodeEntry* self = const_cast<NodeEntry*>(this); _proxy->registerWithReplica_async(new RegisterCB(self), _cache.getReplicaCache().getInternalRegistry()); _proxy = 0; // Registration with the proxy is only attempted once. } diff --git a/cpp/src/IceGrid/NodeSessionI.cpp b/cpp/src/IceGrid/NodeSessionI.cpp index a86c04600df..d14a8e171f7 100644 --- a/cpp/src/IceGrid/NodeSessionI.cpp +++ b/cpp/src/IceGrid/NodeSessionI.cpp @@ -38,7 +38,8 @@ NodeSessionI::NodeSessionI(const DatabasePtr& database, info.proxy = _node; _database->addInternalObject(info, true); // Add or update previous node proxy. - _proxy = NodeSessionPrx::uncheckedCast(_database->getInternalAdapter()->addWithUUID(this)); + Ice::ObjectPrx prx = _database->getInternalAdapter()->addWithUUID(this)->ice_timeout(timeout * 1000); + _proxy = NodeSessionPrx::uncheckedCast(prx); } catch(...) { @@ -219,7 +220,7 @@ NodeSessionI::destroyImpl(bool shutdown) // // Next we notify the observer. // - NodeObserverTopicPtr::dynamicCast(_database->getObserverTopic(NodeObserverTopicName))->nodeDown(_info.name); + NodeObserverTopicPtr::dynamicCast(_database->getObserverTopic(NodeObserverTopicName))->nodeDown(_info.name); // // Unsubscribe the node replica observer. diff --git a/cpp/src/IceGrid/RegistryI.cpp b/cpp/src/IceGrid/RegistryI.cpp index 91724513ee4..dc4b09ce6e8 100644 --- a/cpp/src/IceGrid/RegistryI.cpp +++ b/cpp/src/IceGrid/RegistryI.cpp @@ -1150,6 +1150,9 @@ RegistryI::registerReplicas(const InternalRegistryPrx& internalRegistry, set<NodePrx> nodes; nodes.insert(dbNodes.begin(), dbNodes.end()); + int timeout = + _communicator->getProperties()->getPropertyAsIntWithDefault("IceGrid.Registry.ReplicaSessionTimeout", 30); + for(InternalRegistryPrxSeq::const_iterator r = replicas.begin(); r != replicas.end(); ++r) { if((*r)->ice_getIdentity() != internalRegistry->ice_getIdentity()) @@ -1171,6 +1174,7 @@ RegistryI::registerReplicas(const InternalRegistryPrx& internalRegistry, try { + InternalRegistryPrx replica = InternalRegistryPrx::uncheckedCast((*r)->ice_timeout(timeout * 1000)); (*r)->registerWithReplica(internalRegistry); NodePrxSeq nds = (*r)->getNodes(); nodes.insert(nds.begin(), nds.end()); @@ -1220,12 +1224,16 @@ void RegistryI::registerNodes(const InternalRegistryPrx& internalRegistry, const NodePrxSeq& nodes) { const string prefix("Node-"); + + int timeout = + _communicator->getProperties()->getPropertyAsIntWithDefault("IceGrid.Registry.NodeSessionTimeout", 30); for(NodePrxSeq::const_iterator p = nodes.begin(); p != nodes.end(); ++p) { assert((*p)->ice_getIdentity().name.find(prefix) != string::npos); try { - _database->getNode((*p)->ice_getIdentity().name.substr(prefix.size()))->setProxy(*p); + NodePrx node = NodePrx::uncheckedCast((*p)->ice_timeout(timeout * 1000)); + _database->getNode((*p)->ice_getIdentity().name.substr(prefix.size()))->setProxy(node); } catch(const NodeNotExistException&) { diff --git a/cpp/src/IceGrid/ReplicaSessionI.cpp b/cpp/src/IceGrid/ReplicaSessionI.cpp index 9b1696dd653..0a8fa0450f9 100644 --- a/cpp/src/IceGrid/ReplicaSessionI.cpp +++ b/cpp/src/IceGrid/ReplicaSessionI.cpp @@ -48,7 +48,8 @@ ReplicaSessionI::ReplicaSessionI(const DatabasePtr& database, ObserverTopicPtr obsv = _database->getObserverTopic(RegistryObserverTopicName); RegistryObserverTopicPtr::dynamicCast(obsv)->registryUp(_info); - _proxy = ReplicaSessionPrx::uncheckedCast(_database->getInternalAdapter()->addWithUUID(this)); + Ice::ObjectPrx prx = _database->getInternalAdapter()->addWithUUID(this)->ice_timeout(timeout * 1000); + _proxy = ReplicaSessionPrx::uncheckedCast(prx); } catch(...) { diff --git a/cpp/src/IceGrid/SessionManager.h b/cpp/src/IceGrid/SessionManager.h index 84dafe96310..c4ebfc887f6 100644 --- a/cpp/src/IceGrid/SessionManager.h +++ b/cpp/src/IceGrid/SessionManager.h @@ -76,6 +76,7 @@ public: { _registry = registry; } + if(_nextAction == Connect && _state == Connected) { _nextAction = KeepAlive; @@ -121,7 +122,7 @@ public: assert(_nextAction != None); action = _nextAction; - registry = _registry; + registry = InternalRegistryPrx::uncheckedCast(_registry->ice_timeout(timeout.toMilliSeconds())); _nextAction = None; _state = InProgress; notifyAll(); |