summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
authorBenoit Foucher <benoit@zeroc.com>2007-02-06 15:14:12 +0000
committerBenoit Foucher <benoit@zeroc.com>2007-02-06 15:14:12 +0000
commit441cb69f5311c08f6b2a842674d8bdc93351c739 (patch)
tree1c00a9667f77d7d691eed43c364e9f6c01ee7eb8 /cpp/src
parentMinor cleanup (diff)
downloadice-441cb69f5311c08f6b2a842674d8bdc93351c739.tar.bz2
ice-441cb69f5311c08f6b2a842674d8bdc93351c739.tar.xz
ice-441cb69f5311c08f6b2a842674d8bdc93351c739.zip
Added sync to create
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/IceGrid/NodeSessionManager.cpp55
1 files changed, 29 insertions, 26 deletions
diff --git a/cpp/src/IceGrid/NodeSessionManager.cpp b/cpp/src/IceGrid/NodeSessionManager.cpp
index f723134a0a5..54c3aea3125 100644
--- a/cpp/src/IceGrid/NodeSessionManager.cpp
+++ b/cpp/src/IceGrid/NodeSessionManager.cpp
@@ -205,37 +205,40 @@ NodeSessionManager::NodeSessionManager() :
void
NodeSessionManager::create(const NodeIPtr& node)
{
- assert(!_node);
+ {
+ Lock sync(*this);
+ assert(!_node);
- const_cast<NodeIPtr&>(_node) = node;
+ const_cast<NodeIPtr&>(_node) = node;
- Ice::CommunicatorPtr communicator = _node->getCommunicator();
- assert(communicator->getDefaultLocator());
- Ice::Identity id = communicator->getDefaultLocator()->ice_getIdentity();
+ Ice::CommunicatorPtr communicator = _node->getCommunicator();
+ assert(communicator->getDefaultLocator());
+ Ice::Identity id = communicator->getDefaultLocator()->ice_getIdentity();
- //
- // Initialize the IceGrid::Query objects. The IceGrid::Query
- // interface is used to lookup the registry proxy in case it
- // becomes unavailable. Since replicas might not always have
- // an up to date registry proxy, we need to query all the
- // replicas.
- //
- Ice::EndpointSeq endpoints = communicator->getDefaultLocator()->ice_getEndpoints();
- id.name = "Query";
- QueryPrx query = QueryPrx::uncheckedCast(communicator->stringToProxy(communicator->identityToString(id)));
- for(Ice::EndpointSeq::const_iterator p = endpoints.begin(); p != endpoints.end(); ++p)
- {
- Ice::EndpointSeq singleEndpoint;
- singleEndpoint.push_back(*p);
- _queryObjects.push_back(QueryPrx::uncheckedCast(query->ice_endpoints(singleEndpoint)));
- }
+ //
+ // Initialize the IceGrid::Query objects. The IceGrid::Query
+ // interface is used to lookup the registry proxy in case it
+ // becomes unavailable. Since replicas might not always have
+ // an up to date registry proxy, we need to query all the
+ // replicas.
+ //
+ Ice::EndpointSeq endpoints = communicator->getDefaultLocator()->ice_getEndpoints();
+ id.name = "Query";
+ QueryPrx query = QueryPrx::uncheckedCast(communicator->stringToProxy(communicator->identityToString(id)));
+ for(Ice::EndpointSeq::const_iterator p = endpoints.begin(); p != endpoints.end(); ++p)
+ {
+ Ice::EndpointSeq singleEndpoint;
+ singleEndpoint.push_back(*p);
+ _queryObjects.push_back(QueryPrx::uncheckedCast(query->ice_endpoints(singleEndpoint)));
+ }
- id.name = "InternalRegistry-Master";
- _master = InternalRegistryPrx::uncheckedCast(communicator->stringToProxy(communicator->identityToString(id)));
+ id.name = "InternalRegistry-Master";
+ _master = InternalRegistryPrx::uncheckedCast(communicator->stringToProxy(communicator->identityToString(id)));
+
+ _thread = new Thread(*this);
+ _thread->start();
+ }
- _thread = new Thread(*this);
- _thread->start();
-
//
// Try to create the session. It's important that we wait for the
// creation of the session as this will also try to create sessions