diff options
author | Benoit Foucher <benoit@zeroc.com> | 2014-07-28 17:52:13 +0200 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2014-07-28 17:52:13 +0200 |
commit | 7d6e3b963cb4598b5c4352b800afefa73d26c807 (patch) | |
tree | 06690abd96be25de4107628bf8e17fda78a02faf /cpp/src/IceGrid/SessionManager.cpp | |
parent | Fixed .gitignore files (diff) | |
download | ice-7d6e3b963cb4598b5c4352b800afefa73d26c807.tar.bz2 ice-7d6e3b963cb4598b5c4352b800afefa73d26c807.tar.xz ice-7d6e3b963cb4598b5c4352b800afefa73d26c807.zip |
Fixed ICE-5602 - IceGrid/replication test failure on Windows
Diffstat (limited to 'cpp/src/IceGrid/SessionManager.cpp')
-rw-r--r-- | cpp/src/IceGrid/SessionManager.cpp | 50 |
1 files changed, 26 insertions, 24 deletions
diff --git a/cpp/src/IceGrid/SessionManager.cpp b/cpp/src/IceGrid/SessionManager.cpp index dcc4d500c2f..9d4a5772af8 100644 --- a/cpp/src/IceGrid/SessionManager.cpp +++ b/cpp/src/IceGrid/SessionManager.cpp @@ -34,13 +34,19 @@ vector<QueryPrx> SessionManager::findAllQueryObjects(bool cached) { vector<QueryPrx> queryObjects; + Ice::LocatorPrx locator; { Lock sync(*this); + if(!_communicator) + { + return queryObjects; + } if(cached && !_queryObjects.empty()) { return _queryObjects; } queryObjects = _queryObjects; + locator = _communicator->getDefaultLocator(); } if(!cached) @@ -62,39 +68,35 @@ SessionManager::findAllQueryObjects(bool cached) queryObjects.clear(); } - if(queryObjects.empty()) + if(queryObjects.empty() && locator) { - Ice::LocatorPrx locator = _communicator->getDefaultLocator(); - if(locator) + Ice::Identity id; + id.category = _instanceName; + id.name = "Query"; + QueryPrx query = QueryPrx::uncheckedCast(locator->ice_identity(id)); + Ice::EndpointSeq endpoints = query->ice_getEndpoints(); + if(endpoints.empty()) { - Ice::Identity id; - id.category = _instanceName; - id.name = "Query"; - QueryPrx query = QueryPrx::uncheckedCast(locator->ice_identity(id)); - Ice::EndpointSeq endpoints = query->ice_getEndpoints(); - if(endpoints.empty()) + try { - try - { - Ice::ObjectPrx r = locator->findObjectById(id); - if(r) - { - endpoints = r->ice_getEndpoints(); - } - } - catch(const Ice::Exception&) + Ice::ObjectPrx r = locator->findObjectById(id); + if(r) { - // Ignore. + endpoints = r->ice_getEndpoints(); } } - - for(Ice::EndpointSeq::const_iterator p = endpoints.begin(); p != endpoints.end(); ++p) + catch(const Ice::Exception&) { - Ice::EndpointSeq singleEndpoint; - singleEndpoint.push_back(*p); - queryObjects.push_back(QueryPrx::uncheckedCast(query->ice_endpoints(singleEndpoint))); + // Ignore. } } + + 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))); + } } map<Ice::Identity, QueryPrx> proxies; |