NodeI::NodeI(const InstancePtr& instance, const ReplicaPtr& replica, const Ice::ObjectPrx& replicaProxy, int id, const map<int, NodePrx>& nodes) : _timer(instance->timer()), _traceLevels(instance->traceLevels()), _observers(instance->observers()), _replica(replica), _replicaProxy(replicaProxy), _id(id), _nodes(nodes), _state(NodeStateInactive), _updateCounter(0), _max(0), _generation(-1), _destroy(false) { map<int, NodePrx> oneway; for(map<int, NodePrx>::const_iterator p = _nodes.begin(); p != _nodes.end(); ++p) { oneway[p->first] = NodePrx::uncheckedCast(p->second->ice_oneway()); } const_cast<map<int, NodePrx>& >(_nodesOneway) = oneway; Ice::PropertiesPtr properties = instance->communicator()->getProperties(); const_cast<IceUtil::Time&>(_masterTimeout) = getTimeout( instance->serviceName() + ".Election.MasterTimeout", 10, properties, _traceLevels); const_cast<IceUtil::Time&>(_electionTimeout) = getTimeout( instance->serviceName() + ".Election.ElectionTimeout", 10, properties, _traceLevels); const_cast<IceUtil::Time&>(_mergeTimeout) = getTimeout( instance->serviceName() + ".Election.ResponseTimeout", 10, properties, _traceLevels); }
TopicManagerImpl::TopicManagerImpl(const InstancePtr& instance) : _instance(instance), _connection(Freeze::createConnection(instance->communicator(), instance->serviceName())) { try { __setNoDelete(true); if(_instance->observer()) { _instance->observer()->setObserverUpdater(this); } // TODO: If we want to improve the performance of the // non-replicated case we could allocate a null-topic manager impl // here. _managerImpl = new TopicManagerI(instance, this); Ice::PropertiesPtr properties = _instance->communicator()->getProperties(); // If there is no node adapter we don't need to start the // observer, nor sync since we're not replicating. if(_instance->nodeAdapter()) { _observerImpl = new ReplicaObserverI(instance, this); _observer = _instance->nodeAdapter()->addWithUUID(_observerImpl); _syncImpl = new TopicManagerSyncI(this); _sync = _instance->nodeAdapter()->addWithUUID(_syncImpl); } // Ensure that the llu counter is present in the log. LogUpdate empty = {0, 0}; putLLU(_connection, empty); // Recreate each of the topics. SubscriberMap subscriberMap(_connection, subscriberDbName); SubscriberMap::const_iterator p = subscriberMap.begin(); while(p != subscriberMap.end()) { // This record has to be a place holder record, otherwise // there is a database bug. assert(p->first.id.name.empty() && p->first.id.category.empty()); Ice::Identity topic = p->first.topic; // Skip the place holder. ++p; SubscriberRecordSeq content; while(p != subscriberMap.end() && p->first.topic == topic) { content.push_back(p->second); ++p; } string name = identityToTopicName(topic); installTopic(name, topic, false, content); } } catch(...) { shutdown(); __setNoDelete(false); throw; } __setNoDelete(false); }