diff options
Diffstat (limited to 'cpp/src/IceGrid/ReplicaSessionI.cpp')
-rw-r--r-- | cpp/src/IceGrid/ReplicaSessionI.cpp | 134 |
1 files changed, 67 insertions, 67 deletions
diff --git a/cpp/src/IceGrid/ReplicaSessionI.cpp b/cpp/src/IceGrid/ReplicaSessionI.cpp index 67c633308ff..1fb589470a2 100644 --- a/cpp/src/IceGrid/ReplicaSessionI.cpp +++ b/cpp/src/IceGrid/ReplicaSessionI.cpp @@ -29,10 +29,10 @@ operator==(const ObjectInfo& info, const Ice::Identity& id) } ReplicaSessionI::ReplicaSessionI(const DatabasePtr& database, - const WellKnownObjectsManagerPtr& wellKnownObjects, - const InternalReplicaInfoPtr& info, - const InternalRegistryPrx& proxy, - int timeout) : + const WellKnownObjectsManagerPtr& wellKnownObjects, + const InternalReplicaInfoPtr& info, + const InternalRegistryPrx& proxy, + int timeout) : _database(database), _wellKnownObjects(wellKnownObjects), _traceLevels(database->getTraceLevels()), @@ -45,27 +45,27 @@ ReplicaSessionI::ReplicaSessionI(const DatabasePtr& database, __setNoDelete(true); try { - _database->getReplicaCache().add(info->name, this); + _database->getReplicaCache().add(info->name, this); - ObserverTopicPtr obsv = _database->getObserverTopic(RegistryObserverTopicName); - RegistryObserverTopicPtr::dynamicCast(obsv)->registryUp(toRegistryInfo(_info)); + ObserverTopicPtr obsv = _database->getObserverTopic(RegistryObserverTopicName); + RegistryObserverTopicPtr::dynamicCast(obsv)->registryUp(toRegistryInfo(_info)); - _proxy = ReplicaSessionPrx::uncheckedCast(_database->getInternalAdapter()->addWithUUID(this)); + _proxy = ReplicaSessionPrx::uncheckedCast(_database->getInternalAdapter()->addWithUUID(this)); } catch(const ReplicaActiveException&) { - __setNoDelete(false); - throw; + __setNoDelete(false); + throw; } catch(...) { - ObserverTopicPtr obsv = _database->getObserverTopic(RegistryObserverTopicName); - RegistryObserverTopicPtr::dynamicCast(obsv)->registryDown(_info->name); + ObserverTopicPtr obsv = _database->getObserverTopic(RegistryObserverTopicName); + RegistryObserverTopicPtr::dynamicCast(obsv)->registryDown(_info->name); - _database->getReplicaCache().remove(_info->name, false); + _database->getReplicaCache().remove(_info->name, false); - __setNoDelete(false); - throw; + __setNoDelete(false); + throw; } __setNoDelete(false); } @@ -76,15 +76,15 @@ ReplicaSessionI::keepAlive(const Ice::Current& current) Lock sync(*this); if(_destroy) { - throw Ice::ObjectNotExistException(__FILE__, __LINE__); + throw Ice::ObjectNotExistException(__FILE__, __LINE__); } _timestamp = IceUtil::Time::now(); if(_traceLevels->replica > 2) { - Ice::Trace out(_traceLevels->logger, _traceLevels->replicaCat); - out << "replica `" << _info->name << "' keep alive "; + Ice::Trace out(_traceLevels->logger, _traceLevels->replicaCat); + out << "replica `" << _info->name << "' keep alive "; } } @@ -100,8 +100,8 @@ ReplicaSessionI::setDatabaseObserver(const DatabaseObserverPrx& observer, const Lock sync(*this); if(_destroy) { - throw Ice::ObjectNotExistException(__FILE__, __LINE__); - } + throw Ice::ObjectNotExistException(__FILE__, __LINE__); + } _observer = observer; _database->getObserverTopic(ApplicationObserverTopicName)->subscribe(_observer, _info->name); _database->getObserverTopic(AdapterObserverTopicName)->subscribe(_observer, _info->name); @@ -112,12 +112,12 @@ void ReplicaSessionI::setEndpoints(const StringObjectProxyDict& endpoints, const Ice::Current& current) { { - Lock sync(*this); - if(_destroy) - { - throw Ice::ObjectNotExistException(__FILE__, __LINE__); - } - _replicaEndpoints = endpoints; + Lock sync(*this); + if(_destroy) + { + throw Ice::ObjectNotExistException(__FILE__, __LINE__); + } + _replicaEndpoints = endpoints; } _wellKnownObjects->updateReplicatedWellKnownObjects(); } @@ -127,13 +127,13 @@ ReplicaSessionI::registerWellKnownObjects(const ObjectInfoSeq& objects, const Ic { int serial; { - Lock sync(*this); - if(_destroy) - { - throw Ice::ObjectNotExistException(__FILE__, __LINE__); - } - _replicaWellKnownObjects = objects; - serial = _database->addOrUpdateObjectsInDatabase(objects); + Lock sync(*this); + if(_destroy) + { + throw Ice::ObjectNotExistException(__FILE__, __LINE__); + } + _replicaWellKnownObjects = objects; + serial = _database->addOrUpdateObjectsInDatabase(objects); } // @@ -147,13 +147,13 @@ ReplicaSessionI::registerWellKnownObjects(const ObjectInfoSeq& objects, const Ic void ReplicaSessionI::setAdapterDirectProxy(const string& adapterId, - const string& replicaGroupId, - const Ice::ObjectPrx& proxy, - const Ice::Current&) + const string& replicaGroupId, + const Ice::ObjectPrx& proxy, + const Ice::Current&) { if(_database->getCommunicator()->getProperties()->getPropertyAsInt("IceGrid.Registry.DynamicRegistration") <= 0) { - throw AdapterNotExistException(); + throw AdapterNotExistException(); } _database->setAdapterDirectProxy(adapterId, replicaGroupId, proxy); } @@ -164,7 +164,7 @@ ReplicaSessionI::receivedUpdate(TopicName topicName, int serial, const string& f ObserverTopicPtr topic = _database->getObserverTopic(topicName); if(topic) { - topic->receivedUpdate(_info->name, serial, failure); + topic->receivedUpdate(_info->name, serial, failure); } } @@ -180,7 +180,7 @@ ReplicaSessionI::timestamp() const Lock sync(*this); if(_destroy) { - throw Ice::ObjectNotExistException(__FILE__, __LINE__); + throw Ice::ObjectNotExistException(__FILE__, __LINE__); } return _timestamp; } @@ -215,7 +215,7 @@ ReplicaSessionI::getEndpoint(const std::string& name) Lock sync(*this); if(_destroy) { - return 0; + return 0; } return _replicaEndpoints[name]; } @@ -231,38 +231,38 @@ void ReplicaSessionI::destroyImpl(bool shutdown) { { - Lock sync(*this); - if(_destroy) - { - throw Ice::ObjectNotExistException(__FILE__, __LINE__); - } - _destroy = true; + Lock sync(*this); + if(_destroy) + { + throw Ice::ObjectNotExistException(__FILE__, __LINE__); + } + _destroy = true; } if(_observer) { - _database->getObserverTopic(ApplicationObserverTopicName)->unsubscribe(_observer, _info->name); - _database->getObserverTopic(AdapterObserverTopicName)->unsubscribe(_observer, _info->name); - _database->getObserverTopic(ObjectObserverTopicName)->unsubscribe(_observer, _info->name); + _database->getObserverTopic(ApplicationObserverTopicName)->unsubscribe(_observer, _info->name); + _database->getObserverTopic(AdapterObserverTopicName)->unsubscribe(_observer, _info->name); + _database->getObserverTopic(ObjectObserverTopicName)->unsubscribe(_observer, _info->name); } if(!_replicaWellKnownObjects.empty()) { - if(shutdown) // Don't remove the replica proxy from the database if the registry is being shutdown. - { - ObjectInfoSeq::iterator p = find(_replicaWellKnownObjects.begin(), _replicaWellKnownObjects.end(), - _internalRegistry->ice_getIdentity()); - if(p != _replicaWellKnownObjects.end()) - { - _replicaWellKnownObjects.erase(p); - } - } - _database->removeObjectsInDatabase(_replicaWellKnownObjects); + if(shutdown) // Don't remove the replica proxy from the database if the registry is being shutdown. + { + ObjectInfoSeq::iterator p = find(_replicaWellKnownObjects.begin(), _replicaWellKnownObjects.end(), + _internalRegistry->ice_getIdentity()); + if(p != _replicaWellKnownObjects.end()) + { + _replicaWellKnownObjects.erase(p); + } + } + _database->removeObjectsInDatabase(_replicaWellKnownObjects); } if(!shutdown) { - _wellKnownObjects->updateReplicatedWellKnownObjects(); // No need to update these if we're shutting down. + _wellKnownObjects->updateReplicatedWellKnownObjects(); // No need to update these if we're shutting down. } // @@ -280,12 +280,12 @@ ReplicaSessionI::destroyImpl(bool shutdown) if(!shutdown) { - try - { - _database->getInternalAdapter()->remove(_proxy->ice_getIdentity()); - } - catch(const Ice::ObjectAdapterDeactivatedException&) - { - } + try + { + _database->getInternalAdapter()->remove(_proxy->ice_getIdentity()); + } + catch(const Ice::ObjectAdapterDeactivatedException&) + { + } } } |