diff options
Diffstat (limited to 'cpp/src/IceGrid/Topics.cpp')
-rw-r--r-- | cpp/src/IceGrid/Topics.cpp | 530 |
1 files changed, 265 insertions, 265 deletions
diff --git a/cpp/src/IceGrid/Topics.cpp b/cpp/src/IceGrid/Topics.cpp index 546729cf464..51da20ee1ad 100644 --- a/cpp/src/IceGrid/Topics.cpp +++ b/cpp/src/IceGrid/Topics.cpp @@ -22,11 +22,11 @@ ObserverTopic::ObserverTopic(const IceStorm::TopicManagerPrx& topicManager, cons IceStorm::TopicPrx t; try { - t = topicManager->create(name); + t = topicManager->create(name); } catch(const IceStorm::TopicExists&) { - t = topicManager->retrieve(name); + t = topicManager->retrieve(name); } // @@ -48,7 +48,7 @@ ObserverTopic::subscribe(const Ice::ObjectPrx& obsv, const string& name) Lock sync(*this); if(!_topic) { - return; + return; } assert(obsv); @@ -60,15 +60,15 @@ ObserverTopic::subscribe(const Ice::ObjectPrx& obsv, const string& name) } catch(const IceStorm::AlreadySubscribed&) { - throw ObserverAlreadyRegisteredException(obsv->ice_getIdentity()); + throw ObserverAlreadyRegisteredException(obsv->ice_getIdentity()); } if(!name.empty()) { - assert(_syncSubscribers.find(name) == _syncSubscribers.end()); - _syncSubscribers.insert(name); - addExpectedUpdate(_serial, name); - waitForSyncedSubscribersNoSync(_serial, name); + assert(_syncSubscribers.find(name) == _syncSubscribers.end()); + _syncSubscribers.insert(name); + addExpectedUpdate(_serial, name); + waitForSyncedSubscribersNoSync(_serial, name); } } @@ -78,36 +78,36 @@ ObserverTopic::unsubscribe(const Ice::ObjectPrx& observer, const string& name) Lock sync(*this); if(_topic) { - _topic->unsubscribe(observer); + _topic->unsubscribe(observer); } assert(observer); if(!name.empty()) { - assert(_syncSubscribers.find(name) != _syncSubscribers.end()); - _syncSubscribers.erase(name); - - map<int, set<string> >::iterator p = _waitForUpdates.begin(); - bool notifyMonitor = false; - while(p != _waitForUpdates.end()) - { - p->second.erase(name); - if(p->second.empty()) - { - _waitForUpdates.erase(p++); - notifyMonitor = true; - } - else - { - ++p; - } - } + assert(_syncSubscribers.find(name) != _syncSubscribers.end()); + _syncSubscribers.erase(name); + + map<int, set<string> >::iterator p = _waitForUpdates.begin(); + bool notifyMonitor = false; + while(p != _waitForUpdates.end()) + { + p->second.erase(name); + if(p->second.empty()) + { + _waitForUpdates.erase(p++); + notifyMonitor = true; + } + else + { + ++p; + } + } - if(notifyMonitor) - { - notifyAll(); - } + if(notifyMonitor) + { + notifyAll(); + } } } @@ -126,24 +126,24 @@ ObserverTopic::receivedUpdate(const string& name, int serial, const string& fail map<int, set<string> >::iterator p = _waitForUpdates.find(serial); if(p != _waitForUpdates.end()) { - p->second.erase(name); - - if(!failure.empty()) - { - map<int, map<string, string> >::iterator q = _updateFailures.find(serial); - if(q == _updateFailures.end()) - { - q = _updateFailures.insert(make_pair(serial, map<string ,string>())).first; - } - q->second.insert(make_pair(name, failure)); - } + p->second.erase(name); + + if(!failure.empty()) + { + map<int, map<string, string> >::iterator q = _updateFailures.find(serial); + if(q == _updateFailures.end()) + { + q = _updateFailures.insert(make_pair(serial, map<string ,string>())).first; + } + q->second.insert(make_pair(name, failure)); + } - if(p->second.empty()) - { - _waitForUpdates.erase(p); - } + if(p->second.empty()) + { + _waitForUpdates.erase(p); + } - notifyAll(); + notifyAll(); } } @@ -159,18 +159,18 @@ ObserverTopic::addExpectedUpdate(int serial, const string& name) { if(_syncSubscribers.empty() && name.empty()) { - return; + return; } // Must be called with the lock held. if(name.empty()) { - assert(_waitForUpdates[serial].empty()); - _waitForUpdates[serial] = _syncSubscribers; + assert(_waitForUpdates[serial].empty()); + _waitForUpdates[serial] = _syncSubscribers; } else { - _waitForUpdates[serial].insert(name); + _waitForUpdates[serial].insert(name); } } @@ -179,7 +179,7 @@ ObserverTopic::waitForSyncedSubscribersNoSync(int serial, const string& name) { if(serial < 0) { - return; + return; } // @@ -187,33 +187,33 @@ ObserverTopic::waitForSyncedSubscribersNoSync(int serial, const string& name) // while(true) { - map<int, set<string> >::const_iterator p = _waitForUpdates.find(serial); - if(p == _waitForUpdates.end()) - { - map<int, map<string, string> >::iterator q = _updateFailures.find(serial); - if(q != _updateFailures.end()) - { - map<string, string> failures = q->second; - _updateFailures.erase(q); - ostringstream os; - for(map<string, string>::const_iterator r = failures.begin(); r != failures.end(); ++r) - { - os << "replication failed on replica `" << r->first << "':\n" << r->second << "\n"; - } - - Ice::Error err(_logger); - err << os.str(); - } - return; - } - else - { - if(!name.empty() && p->second.find(name) == p->second.end()) - { - return; - } - wait(); - } + map<int, set<string> >::const_iterator p = _waitForUpdates.find(serial); + if(p == _waitForUpdates.end()) + { + map<int, map<string, string> >::iterator q = _updateFailures.find(serial); + if(q != _updateFailures.end()) + { + map<string, string> failures = q->second; + _updateFailures.erase(q); + ostringstream os; + for(map<string, string>::const_iterator r = failures.begin(); r != failures.end(); ++r) + { + os << "replication failed on replica `" << r->first << "':\n" << r->second << "\n"; + } + + Ice::Error err(_logger); + err << os.str(); + } + return; + } + else + { + if(!name.empty() && p->second.find(name) == p->second.end()) + { + return; + } + wait(); + } } } @@ -247,18 +247,18 @@ RegistryObserverTopic::registryUp(const RegistryInfo& info) Lock sync(*this); if(!_topic) { - return; + return; } updateSerial(_serial + 1); _registries.insert(make_pair(info.name, info)); try { - _publisher->registryUp(info); + _publisher->registryUp(info); } catch(const Ice::LocalException& ex) { - Ice::Warning out(_logger); - out << "unexpected exception while publishing `registryUp' update:\n" << ex; + Ice::Warning out(_logger); + out << "unexpected exception while publishing `registryUp' update:\n" << ex; } } @@ -268,24 +268,24 @@ RegistryObserverTopic::registryDown(const string& name) Lock sync(*this); if(!_topic) { - return; + return; } if(_registries.find(name) == _registries.end()) { - return; + return; } updateSerial(_serial + 1); _registries.erase(name); try { - _publisher->registryDown(name); + _publisher->registryDown(name); } catch(const Ice::LocalException& ex) { - Ice::Warning out(_logger); - out << "unexpected exception while publishing `registryDown' update:\n" << ex; + Ice::Warning out(_logger); + out << "unexpected exception while publishing `registryDown' update:\n" << ex; } } @@ -297,19 +297,19 @@ RegistryObserverTopic::initObserver(const Ice::ObjectPrx& obsv) registries.reserve(_registries.size()); for(map<string, RegistryInfo>::const_iterator p = _registries.begin(); p != _registries.end(); ++p) { - registries.push_back(p->second); + registries.push_back(p->second); } observer->registryInit(registries, getContext(_serial)); } NodeObserverTopic::NodeObserverTopic(const IceStorm::TopicManagerPrx& topicManager, - const Ice::ObjectAdapterPtr& adapter) : + const Ice::ObjectAdapterPtr& adapter) : ObserverTopic(topicManager, "NodeObserver") { const_cast<NodeObserverPrx&>(_publisher) = NodeObserverPrx::uncheckedCast(_basePublisher); try { - const_cast<NodeObserverPrx&>(_externalPublisher) = NodeObserverPrx::uncheckedCast(adapter->addWithUUID(this)); + const_cast<NodeObserverPrx&>(_externalPublisher) = NodeObserverPrx::uncheckedCast(adapter->addWithUUID(this)); } catch(const Ice::LocalException&) { @@ -328,18 +328,18 @@ NodeObserverTopic::nodeUp(const NodeDynamicInfo& info, const Ice::Current& curre Lock sync(*this); if(!_topic) { - return; + return; } updateSerial(_serial + 1); _nodes.insert(make_pair(info.info.name, info)); try { - _publisher->nodeUp(info); + _publisher->nodeUp(info); } catch(const Ice::LocalException& ex) { - Ice::Warning out(_logger); - out << "unexpected exception while publishing 'nodeUp' update:\n" << ex; + Ice::Warning out(_logger); + out << "unexpected exception while publishing 'nodeUp' update:\n" << ex; } } @@ -355,15 +355,15 @@ NodeObserverTopic::updateServer(const string& node, const ServerDynamicInfo& ser Lock sync(*this); if(!_topic) { - return; + return; } if(_nodes.find(node) == _nodes.end()) { - // - // If the node isn't known anymore, we ignore the update. - // - return; + // + // If the node isn't known anymore, we ignore the update. + // + return; } updateSerial(_serial + 1); @@ -372,33 +372,33 @@ NodeObserverTopic::updateServer(const string& node, const ServerDynamicInfo& ser ServerDynamicInfoSeq::iterator p = servers.begin(); while(p != servers.end()) { - if(p->id == server.id) - { - if(server.state == Destroyed || (server.state == Inactive && server.enabled)) - { - servers.erase(p); - } - else - { - *p = server; - } - break; - } - ++p; + if(p->id == server.id) + { + if(server.state == Destroyed || (server.state == Inactive && server.enabled)) + { + servers.erase(p); + } + else + { + *p = server; + } + break; + } + ++p; } if(server.state != Destroyed && (server.state != Inactive || !server.enabled) && p == servers.end()) { - servers.push_back(server); + servers.push_back(server); } try { - _publisher->updateServer(node, server); + _publisher->updateServer(node, server); } catch(const Ice::LocalException& ex) { - Ice::Warning out(_logger); - out << "unexpected exception while publishing `updateServer' update:\n" << ex; + Ice::Warning out(_logger); + out << "unexpected exception while publishing `updateServer' update:\n" << ex; } } @@ -408,15 +408,15 @@ NodeObserverTopic::updateAdapter(const string& node, const AdapterDynamicInfo& a Lock sync(*this); if(!_topic) { - return; + return; } if(_nodes.find(node) == _nodes.end()) { - // - // If the node isn't known anymore, we ignore the update. - // - return; + // + // If the node isn't known anymore, we ignore the update. + // + return; } updateSerial(_serial + 1); @@ -425,33 +425,33 @@ NodeObserverTopic::updateAdapter(const string& node, const AdapterDynamicInfo& a AdapterDynamicInfoSeq::iterator p = adapters.begin(); while(p != adapters.end()) { - if(p->id == adapter.id) - { - if(adapter.proxy) - { - *p = adapter; - } - else - { - adapters.erase(p); - } - break; - } - ++p; + if(p->id == adapter.id) + { + if(adapter.proxy) + { + *p = adapter; + } + else + { + adapters.erase(p); + } + break; + } + ++p; } if(adapter.proxy && p == adapters.end()) { - adapters.push_back(adapter); + adapters.push_back(adapter); } try { - _publisher->updateAdapter(node, adapter); + _publisher->updateAdapter(node, adapter); } catch(const Ice::LocalException& ex) { - Ice::Warning out(_logger); - out << "unexpected exception while publishing `updateAdapter' update:\n" << ex; + Ice::Warning out(_logger); + out << "unexpected exception while publishing `updateAdapter' update:\n" << ex; } } @@ -461,23 +461,23 @@ NodeObserverTopic::nodeDown(const string& name) Lock sync(*this); if(!_topic) { - return; + return; } updateSerial(_serial + 1); if(_nodes.find(name) != _nodes.end()) { - _nodes.erase(name); - try - { - _publisher->nodeDown(name); - } - catch(const Ice::LocalException& ex) - { - Ice::Warning out(_logger); - out << "unexpected exception while publishing `nodeDown' update:\n" << ex; - } + _nodes.erase(name); + try + { + _publisher->nodeDown(name); + } + catch(const Ice::LocalException& ex) + { + Ice::Warning out(_logger); + out << "unexpected exception while publishing `nodeDown' update:\n" << ex; + } } } @@ -489,13 +489,13 @@ NodeObserverTopic::initObserver(const Ice::ObjectPrx& obsv) nodes.reserve(_nodes.size()); for(map<string, NodeDynamicInfo>::const_iterator p = _nodes.begin(); p != _nodes.end(); ++p) { - nodes.push_back(p->second); + nodes.push_back(p->second); } observer->nodeInit(nodes, getContext(_serial)); } ApplicationObserverTopic::ApplicationObserverTopic(const IceStorm::TopicManagerPrx& topicManager, - const StringApplicationInfoDict& applications) : + const StringApplicationInfoDict& applications) : ObserverTopic(topicManager, "ApplicationObserver") #ifndef _RWSTD_NO_MEMBER_TEMPLATES ,_applications(applications.begin(), applications.end()) @@ -504,7 +504,7 @@ ApplicationObserverTopic::ApplicationObserverTopic(const IceStorm::TopicManagerP #ifdef _RWSTD_NO_MEMBER_TEMPLATES for(StringApplicationInfoDict::const_iterator p = applications.begin(); p != applications.end(); ++p) { - _applications[p->first] = p->second; + _applications[p->first] = p->second; } #endif @@ -517,22 +517,22 @@ ApplicationObserverTopic::applicationInit(int serial, const ApplicationInfoSeq& Lock sync(*this); if(!_topic) { - return -1; + return -1; } updateSerial(serial); _applications.clear(); for(ApplicationInfoSeq::const_iterator p = apps.begin(); p != apps.end(); ++p) { - _applications.insert(make_pair(p->descriptor.name, *p)); + _applications.insert(make_pair(p->descriptor.name, *p)); } try { - _publisher->applicationInit(serial, apps, getContext(serial)); + _publisher->applicationInit(serial, apps, getContext(serial)); } catch(const Ice::LocalException& ex) { - Ice::Warning out(_logger); - out << "unexpected exception while publishing `applicationInit' update:\n" << ex; + Ice::Warning out(_logger); + out << "unexpected exception while publishing `applicationInit' update:\n" << ex; } addExpectedUpdate(serial); return serial; @@ -544,19 +544,19 @@ ApplicationObserverTopic::applicationAdded(int serial, const ApplicationInfo& in Lock sync(*this); if(!_topic) { - return -1; + return -1; } updateSerial(serial); _applications.insert(make_pair(info.descriptor.name, info)); try { - _publisher->applicationAdded(serial, info, getContext(serial)); + _publisher->applicationAdded(serial, info, getContext(serial)); } catch(const Ice::LocalException& ex) { - Ice::Warning out(_logger); - out << "unexpected exception while publishing `applicationAdded' update:\n" << ex; + Ice::Warning out(_logger); + out << "unexpected exception while publishing `applicationAdded' update:\n" << ex; } addExpectedUpdate(serial); return serial; @@ -568,18 +568,18 @@ ApplicationObserverTopic::applicationRemoved(int serial, const string& name) Lock sync(*this); if(!_topic) { - return -1; + return -1; } updateSerial(serial); _applications.erase(name); try { - _publisher->applicationRemoved(serial, name, getContext(serial)); + _publisher->applicationRemoved(serial, name, getContext(serial)); } catch(const Ice::LocalException& ex) { - Ice::Warning out(_logger); - out << "unexpected exception while publishing `applicationRemoved' update:\n" << ex; + Ice::Warning out(_logger); + out << "unexpected exception while publishing `applicationRemoved' update:\n" << ex; } addExpectedUpdate(serial); return serial; @@ -591,49 +591,49 @@ ApplicationObserverTopic::applicationUpdated(int serial, const ApplicationUpdate Lock sync(*this); if(!_topic) { - return -1; + return -1; } updateSerial(serial); try { - map<string, ApplicationInfo>::iterator p = _applications.find(info.descriptor.name); - if(p != _applications.end()) - { - ApplicationHelper helper(_publisher->ice_getCommunicator(), p->second.descriptor); - p->second.descriptor = helper.update(info.descriptor); - p->second.updateTime = info.updateTime; - p->second.updateUser = info.updateUser; - p->second.revision = info.revision; - } + map<string, ApplicationInfo>::iterator p = _applications.find(info.descriptor.name); + if(p != _applications.end()) + { + ApplicationHelper helper(_publisher->ice_getCommunicator(), p->second.descriptor); + p->second.descriptor = helper.update(info.descriptor); + p->second.updateTime = info.updateTime; + p->second.updateUser = info.updateUser; + p->second.revision = info.revision; + } } catch(const DeploymentException& ex) { - cerr << ex.reason << endl; - assert(false); + cerr << ex.reason << endl; + assert(false); } catch(const std::string& msg) { - cerr << msg << endl; - assert(false); + cerr << msg << endl; + assert(false); } catch(const char* msg) { - cerr << msg << endl; - assert(false); + cerr << msg << endl; + assert(false); } catch(...) { - assert(false); + assert(false); } try { - _publisher->applicationUpdated(serial, info, getContext(serial)); + _publisher->applicationUpdated(serial, info, getContext(serial)); } catch(const Ice::LocalException& ex) { - Ice::Warning out(_logger); - out << "unexpected exception while publishing `applicationUpdated' update:\n" << ex; + Ice::Warning out(_logger); + out << "unexpected exception while publishing `applicationUpdated' update:\n" << ex; } addExpectedUpdate(serial); return serial; @@ -646,13 +646,13 @@ ApplicationObserverTopic::initObserver(const Ice::ObjectPrx& obsv) ApplicationInfoSeq applications; for(map<string, ApplicationInfo>::const_iterator p = _applications.begin(); p != _applications.end(); ++p) { - applications.push_back(p->second); + applications.push_back(p->second); } observer->applicationInit(_serial, applications, getContext(_serial)); } AdapterObserverTopic::AdapterObserverTopic(const IceStorm::TopicManagerPrx& topicManager, - const StringAdapterInfoDict& adapters) : + const StringAdapterInfoDict& adapters) : ObserverTopic(topicManager, "AdapterObserver") #ifndef _RWSTD_NO_MEMBER_TEMPLATES , _adapters(adapters.begin(), adapters.end()) @@ -674,22 +674,22 @@ AdapterObserverTopic::adapterInit(const AdapterInfoSeq& adpts) Lock sync(*this); if(!_topic) { - return -1; + return -1; } updateSerial(_serial + 1); _adapters.clear(); for(AdapterInfoSeq::const_iterator q = adpts.begin(); q != adpts.end(); ++q) { - _adapters.insert(make_pair(q->id, *q)); + _adapters.insert(make_pair(q->id, *q)); } try { - _publisher->adapterInit(adpts, getContext(_serial)); + _publisher->adapterInit(adpts, getContext(_serial)); } catch(const Ice::LocalException& ex) { - Ice::Warning out(_logger); - out << "unexpected exception while publishing `adapterInit' update:\n" << ex; + Ice::Warning out(_logger); + out << "unexpected exception while publishing `adapterInit' update:\n" << ex; } addExpectedUpdate(_serial); return _serial; @@ -701,18 +701,18 @@ AdapterObserverTopic::adapterAdded(const AdapterInfo& info) Lock sync(*this); if(!_topic) { - return -1; + return -1; } updateSerial(_serial + 1); _adapters.insert(make_pair(info.id, info)); try { - _publisher->adapterAdded(info, getContext(_serial)); + _publisher->adapterAdded(info, getContext(_serial)); } catch(const Ice::LocalException& ex) { - Ice::Warning out(_logger); - out << "unexpected exception while publishing `adapterAdded' update:\n" << ex; + Ice::Warning out(_logger); + out << "unexpected exception while publishing `adapterAdded' update:\n" << ex; } addExpectedUpdate(_serial); return _serial; @@ -724,18 +724,18 @@ AdapterObserverTopic::adapterUpdated(const AdapterInfo& info) Lock sync(*this); if(!_topic) { - return -1; + return -1; } updateSerial(_serial + 1); _adapters[info.id] = info; try { - _publisher->adapterUpdated(info, getContext(_serial)); + _publisher->adapterUpdated(info, getContext(_serial)); } catch(const Ice::LocalException& ex) { - Ice::Warning out(_logger); - out << "unexpected exception while publishing `adapterUpdated' update:\n" << ex; + Ice::Warning out(_logger); + out << "unexpected exception while publishing `adapterUpdated' update:\n" << ex; } addExpectedUpdate(_serial); return _serial; @@ -747,18 +747,18 @@ AdapterObserverTopic::adapterRemoved(const string& id) Lock sync(*this); if(!_topic) { - return -1; + return -1; } updateSerial(_serial + 1); _adapters.erase(id); try { - _publisher->adapterRemoved(id, getContext(_serial)); + _publisher->adapterRemoved(id, getContext(_serial)); } catch(const Ice::LocalException& ex) { - Ice::Warning out(_logger); - out << "unexpected exception while publishing `adapterRemoved' update:\n" << ex; + Ice::Warning out(_logger); + out << "unexpected exception while publishing `adapterRemoved' update:\n" << ex; } addExpectedUpdate(_serial); return _serial; @@ -771,13 +771,13 @@ AdapterObserverTopic::initObserver(const Ice::ObjectPrx& obsv) AdapterInfoSeq adapters; for(map<string, AdapterInfo>::const_iterator p = _adapters.begin(); p != _adapters.end(); ++p) { - adapters.push_back(p->second); - } + adapters.push_back(p->second); + } observer->adapterInit(adapters, getContext(_serial)); } ObjectObserverTopic::ObjectObserverTopic(const IceStorm::TopicManagerPrx& topicManager, - const IdentityObjectInfoDict& objects) : + const IdentityObjectInfoDict& objects) : ObserverTopic(topicManager, "ObjectObserver") #ifndef _RWSTD_NO_MEMBER_TEMPLATES , _objects(objects.begin(), objects.end()) @@ -799,22 +799,22 @@ ObjectObserverTopic::objectInit(const ObjectInfoSeq& objects) Lock sync(*this); if(!_topic) { - return -1; + return -1; } updateSerial(_serial + 1); _objects.clear(); for(ObjectInfoSeq::const_iterator r = objects.begin(); r != objects.end(); ++r) { - _objects.insert(make_pair(r->proxy->ice_getIdentity(), *r)); + _objects.insert(make_pair(r->proxy->ice_getIdentity(), *r)); } try { - _publisher->objectInit(objects, getContext(_serial)); + _publisher->objectInit(objects, getContext(_serial)); } catch(const Ice::LocalException& ex) { - Ice::Warning out(_logger); - out << "unexpected exception while publishing `objectInit' update:\n" << ex; + Ice::Warning out(_logger); + out << "unexpected exception while publishing `objectInit' update:\n" << ex; } addExpectedUpdate(_serial); return _serial; @@ -826,18 +826,18 @@ ObjectObserverTopic::objectAdded(const ObjectInfo& info) Lock sync(*this); if(!_topic) { - return -1; + return -1; } updateSerial(_serial + 1); _objects.insert(make_pair(info.proxy->ice_getIdentity(), info)); try { - _publisher->objectAdded(info, getContext(_serial)); + _publisher->objectAdded(info, getContext(_serial)); } catch(const Ice::LocalException& ex) { - Ice::Warning out(_logger); - out << "unexpected exception while publishing `objectAdded' update:\n" << ex; + Ice::Warning out(_logger); + out << "unexpected exception while publishing `objectAdded' update:\n" << ex; } addExpectedUpdate(_serial); return _serial; @@ -849,18 +849,18 @@ ObjectObserverTopic::objectUpdated(const ObjectInfo& info) Lock sync(*this); if(!_topic) { - return -1; + return -1; } updateSerial(_serial + 1); _objects[info.proxy->ice_getIdentity()] = info; try { - _publisher->objectUpdated(info, getContext(_serial)); + _publisher->objectUpdated(info, getContext(_serial)); } catch(const Ice::LocalException& ex) { - Ice::Warning out(_logger); - out << "unexpected exception while publishing `objectUpdated' update:\n" << ex; + Ice::Warning out(_logger); + out << "unexpected exception while publishing `objectUpdated' update:\n" << ex; } addExpectedUpdate(_serial); return _serial; @@ -872,18 +872,18 @@ ObjectObserverTopic::objectRemoved(const Ice::Identity& id) Lock sync(*this); if(!_topic) { - return -1; + return -1; } updateSerial(_serial + 1); _objects.erase(id); try { - _publisher->objectRemoved(id, getContext(_serial)); + _publisher->objectRemoved(id, getContext(_serial)); } catch(const Ice::LocalException& ex) { - Ice::Warning out(_logger); - out << "unexpected exception while publishing `objectRemoved' update:\n" << ex; + Ice::Warning out(_logger); + out << "unexpected exception while publishing `objectRemoved' update:\n" << ex; } addExpectedUpdate(_serial); return _serial; @@ -895,39 +895,39 @@ ObjectObserverTopic::objectsAddedOrUpdated(const ObjectInfoSeq& infos) Lock sync(*this); if(!_topic) { - return -1; + return -1; } updateSerial(_serial + 1); for(ObjectInfoSeq::const_iterator p = infos.begin(); p != infos.end(); ++p) { - map<Ice::Identity, ObjectInfo>::iterator q = _objects.find(p->proxy->ice_getIdentity()); - if(q != _objects.end()) - { - q->second = *p; - try - { - _publisher->objectUpdated(*p, getContext(_serial)); - } - catch(const Ice::LocalException& ex) - { - Ice::Warning out(_logger); - out << "unexpected exception while publishing `objectUpdated' update:\n" << ex; - } - } - else - { - _objects.insert(make_pair(p->proxy->ice_getIdentity(), *p)); - try - { - _publisher->objectAdded(*p, getContext(_serial)); - } - catch(const Ice::LocalException& ex) - { - Ice::Warning out(_logger); - out << "unexpected exception while publishing `objectAdded' update:\n" << ex; - } - } + map<Ice::Identity, ObjectInfo>::iterator q = _objects.find(p->proxy->ice_getIdentity()); + if(q != _objects.end()) + { + q->second = *p; + try + { + _publisher->objectUpdated(*p, getContext(_serial)); + } + catch(const Ice::LocalException& ex) + { + Ice::Warning out(_logger); + out << "unexpected exception while publishing `objectUpdated' update:\n" << ex; + } + } + else + { + _objects.insert(make_pair(p->proxy->ice_getIdentity(), *p)); + try + { + _publisher->objectAdded(*p, getContext(_serial)); + } + catch(const Ice::LocalException& ex) + { + Ice::Warning out(_logger); + out << "unexpected exception while publishing `objectAdded' update:\n" << ex; + } + } } // @@ -945,22 +945,22 @@ ObjectObserverTopic::objectsRemoved(const ObjectInfoSeq& infos) Lock sync(*this); if(!_topic) { - return -1; + return -1; } updateSerial(_serial + 1); for(ObjectInfoSeq::const_iterator p = infos.begin(); p != infos.end(); ++p) { - _objects.erase(p->proxy->ice_getIdentity()); - try - { - _publisher->objectRemoved(p->proxy->ice_getIdentity(), getContext(_serial)); - } - catch(const Ice::LocalException& ex) - { - Ice::Warning out(_logger); - out << "unexpected exception while publishing `objectUpdated' update:\n" << ex; - } + _objects.erase(p->proxy->ice_getIdentity()); + try + { + _publisher->objectRemoved(p->proxy->ice_getIdentity(), getContext(_serial)); + } + catch(const Ice::LocalException& ex) + { + Ice::Warning out(_logger); + out << "unexpected exception while publishing `objectUpdated' update:\n" << ex; + } } // @@ -980,7 +980,7 @@ ObjectObserverTopic::initObserver(const Ice::ObjectPrx& obsv) ObjectInfoSeq objects; for(map<Ice::Identity, ObjectInfo>::const_iterator p = _objects.begin(); p != _objects.end(); ++p) { - objects.push_back(p->second); + objects.push_back(p->second); } observer->objectInit(objects, getContext(_serial)); } |