summaryrefslogtreecommitdiff
path: root/cpp/src/IceGrid/NodeSessionManager.cpp
diff options
context:
space:
mode:
authorBenoit Foucher <benoit@zeroc.com>2006-09-12 09:01:35 +0000
committerBenoit Foucher <benoit@zeroc.com>2006-09-12 09:01:35 +0000
commitd89514da858be06f7e44129bcd6675a46181208e (patch)
tree662073ca1e8a9b6e56e9914087da66a824b88d6c /cpp/src/IceGrid/NodeSessionManager.cpp
parentMinor Makefile tweak. (diff)
downloadice-d89514da858be06f7e44129bcd6675a46181208e.tar.bz2
ice-d89514da858be06f7e44129bcd6675a46181208e.tar.xz
ice-d89514da858be06f7e44129bcd6675a46181208e.zip
Fixes
Diffstat (limited to 'cpp/src/IceGrid/NodeSessionManager.cpp')
-rw-r--r--cpp/src/IceGrid/NodeSessionManager.cpp52
1 files changed, 40 insertions, 12 deletions
diff --git a/cpp/src/IceGrid/NodeSessionManager.cpp b/cpp/src/IceGrid/NodeSessionManager.cpp
index d8767a3e0af..680b579369c 100644
--- a/cpp/src/IceGrid/NodeSessionManager.cpp
+++ b/cpp/src/IceGrid/NodeSessionManager.cpp
@@ -47,7 +47,7 @@ NodeSessionKeepAliveThread::createSession(const InternalRegistryPrx& registry, I
int t = session->getTimeout();
if(t > 0)
{
- timeout = IceUtil::Time::seconds(t);
+ timeout = IceUtil::Time::seconds(t / 2);
}
if(traceLevels && traceLevels->replica > 0)
@@ -150,6 +150,14 @@ NodeSessionManager::create(const NodeIPtr& node)
_thread = new Thread(*this, _master);
_thread->start();
+
+ //
+ // We can't wait for the session to be created here as the node
+ // adapter isn't activated yet and the registry would hang trying
+ // to load the servers on the node (when createSession invokes
+ // loadServers() on the session).
+ //
+ //_thread->tryCreateSession(_master);
}
void
@@ -273,6 +281,7 @@ NodeSessionManager::syncReplicas(const InternalRegistryPrxSeq& replicas)
{
thread = new NodeSessionKeepAliveThread(*p, _node);
thread->start();
+ thread->tryCreateSession(*p);
}
_sessions.insert(make_pair((*p)->ice_getIdentity(), thread));
}
@@ -309,7 +318,7 @@ NodeSessionManager::createSession(const InternalRegistryPrx& registry, IceUtil::
int t = session->getTimeout();
if(t > 0)
{
- timeout = IceUtil::Time::seconds(t);
+ timeout = IceUtil::Time::seconds(t / 2);
}
if(traceLevels && traceLevels->replica > 0)
@@ -334,16 +343,6 @@ NodeSessionManager::createSession(const InternalRegistryPrx& registry, IceUtil::
}
}
- if(session)
- {
- _node->setObserver(session->getObserver());
- _node->checkConsistency(session);
- }
- else
- {
- _node->setObserver(0);
- }
-
//
// Get the list of replicas (either with the master session or the
// IceGrid::Query interface) and make sure we have sessions opened
@@ -387,6 +386,35 @@ NodeSessionManager::createSession(const InternalRegistryPrx& registry, IceUtil::
// IGNORE
}
+ //
+ // Ask the master to load the servers on the node. Once this is
+ // done we check the consistency of the node to make sure old
+ // servers are removed.
+ //
+ // NOTE: it's important for this to be done after trying to
+ // register with the replicas. When the master loads the server
+ // some server might get activated and it's better if at that time
+ // the registry replicas (at least the ones which are up) have all
+ // established their session with the node.
+ //
+ try
+ {
+ if(session)
+ {
+ session->loadServers();
+ _node->setObserver(session->getObserver());
+ _node->checkConsistency(session);
+ }
+ else
+ {
+ _node->setObserver(0);
+ }
+ }
+ catch(const Ice::LocalException&)
+ {
+ // IGNORE
+ }
+
return session;
}