本文整理汇总了C++中ice::IdentitySeq::begin方法的典型用法代码示例。如果您正苦于以下问题:C++ IdentitySeq::begin方法的具体用法?C++ IdentitySeq::begin怎么用?C++ IdentitySeq::begin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ice::IdentitySeq
的用法示例。
在下文中一共展示了IdentitySeq::begin方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: txn
void
TopicImpl::removeSubscribers(const Ice::IdentitySeq& ids)
{
// First update the database
LogUpdate llu;
bool found = false;
try
{
IceDB::ReadWriteTxn txn(_instance->dbEnv());
for(Ice::IdentitySeq::const_iterator id = ids.begin(); id != ids.end(); ++id)
{
SubscriberRecordKey key;
key.topic = _id;
key.id = *id;
if(_subscriberMap.del(txn, key))
{
found = true;
}
}
if(found)
{
llu = getIncrementedLLU(txn, _lluMap);
txn.commit();
}
else
{
txn.rollback();
}
}
catch(const IceDB::LMDBException& ex)
{
logError(_instance->communicator(), ex);
throw; // will become UnknownException in caller
}
if(found)
{
// Then remove the subscriber from the subscribers list. Its
// possible that some of these subscribers have already been
// removed (consider, for example, a concurrent reap call from two
// replicas on the same subscriber). To avoid sending unnecessary
// observer updates keep track of the observers that are actually
// removed.
for(Ice::IdentitySeq::const_iterator id = ids.begin(); id != ids.end(); ++id)
{
vector<SubscriberPtr>::iterator p = find(_subscribers.begin(), _subscribers.end(), *id);
if(p != _subscribers.end())
{
(*p)->destroy();
_subscribers.erase(p);
}
}
_instance->observers()->removeSubscriber(llu, _name, ids);
}
}
示例2: out
void
TopicImpl::observerRemoveSubscriber(const LogUpdate& llu, const Ice::IdentitySeq& ids)
{
TraceLevelsPtr traceLevels = _instance->traceLevels();
if(traceLevels->topic > 0)
{
Ice::Trace out(traceLevels->logger, traceLevels->topicCat);
out << _name << ": remove replica observer: ";
for(Ice::IdentitySeq::const_iterator id = ids.begin(); id != ids.end(); ++id)
{
if(id != ids.begin())
{
out << ",";
}
out << _instance->communicator()->identityToString(*id);
}
out << " llu: " << llu.generation << "/" << llu.iteration;
}
IceUtil::Mutex::Lock sync(_subscribersMutex);
// First remove from the database.
try
{
IceDB::ReadWriteTxn txn(_instance->dbEnv());
for(Ice::IdentitySeq::const_iterator id = ids.begin(); id != ids.end(); ++id)
{
SubscriberRecordKey key;
key.topic = _id;
key.id = *id;
_subscriberMap.del(txn, key);
}
_lluMap.put(txn, lluDbKey, llu);
txn.commit();
}
catch(const IceDB::LMDBException& ex)
{
logError(_instance->communicator(), ex);
throw; // will become UnknownException in caller
}
// Then remove the subscriber from the subscribers list. If the
// subscriber had a local failure and was removed from the
// subscriber list it could already be gone. That's not a problem.
for(Ice::IdentitySeq::const_iterator id = ids.begin(); id != ids.end(); ++id)
{
vector<SubscriberPtr>::iterator p = find(_subscribers.begin(), _subscribers.end(), *id);
if(p != _subscribers.end())
{
(*p)->destroy();
_subscribers.erase(p);
}
}
}
示例3: txn
void
TopicImpl::removeSubscribers(const Ice::IdentitySeq& ids)
{
Ice::IdentitySeq removed;
// First remove the subscriber from the subscribers list. Its
// possible that some of these subscribers have already been
// removed (consider, for example, a concurrent reap call from two
// replicas on the same subscriber). To avoid sending unnecessary
// observer updates keep track of the observers that are actually
// removed.
for(Ice::IdentitySeq::const_iterator id = ids.begin(); id != ids.end(); ++id)
{
vector<SubscriberPtr>::iterator p = find(_subscribers.begin(), _subscribers.end(), *id);
if(p != _subscribers.end())
{
(*p)->destroy();
_subscribers.erase(p);
removed.push_back(*id);
}
}
// If there is no further work to do we are done.
if(removed.empty())
{
return;
}
// Next update the database and send the notification to any
// slaves.
LogUpdate llu;
try
{
IceDB::ReadWriteTxn txn(_instance->dbEnv());
for(Ice::IdentitySeq::const_iterator id = ids.begin(); id != ids.end(); ++id)
{
SubscriberRecordKey key;
key.topic = _id;
key.id = *id;
_subscriberMap.del(txn, key);
}
llu = getIncrementedLLU(txn, _lluMap);
txn.commit();
}
catch(const IceDB::LMDBException& ex)
{
halt(_instance->communicator(), ex);
}
_instance->observers()->removeSubscriber(llu, _name, ids);
}
示例4: out
void
TopicImpl::reap(const Ice::IdentitySeq& ids)
{
IceUtil::Mutex::Lock sync(_subscribersMutex);
TraceLevelsPtr traceLevels = _instance->traceLevels();
if(traceLevels->topic > 0)
{
Ice::Trace out(traceLevels->logger, traceLevels->topicCat);
out << _name << ": reap ";
for(Ice::IdentitySeq::const_iterator p = ids.begin(); p != ids.end() ; ++p)
{
if(p != ids.begin())
{
out << ",";
}
out << _instance->communicator()->identityToString(*p);
}
}
removeSubscribers(ids);
}
示例5: txn
void
TopicImpl::removeSubscribers(const Ice::IdentitySeq& ids)
{
Ice::IdentitySeq removed;
// First remove the subscriber from the subscribers list. Its
// possible that some of these subscribers have already been
// removed (consider, for example, a concurrent reap call from two
// replicas on the same subscriber). To avoid sending unnecessary
// observer updates keep track of the observers that are actually
// removed.
for(Ice::IdentitySeq::const_iterator id = ids.begin(); id != ids.end(); ++id)
{
vector<SubscriberPtr>::iterator p = find(_subscribers.begin(), _subscribers.end(), *id);
if(p != _subscribers.end())
{
(*p)->destroy();
_subscribers.erase(p);
removed.push_back(*id);
}
}
// If there is no further work to do we are done.
if(removed.empty())
{
return;
}
// Next update the database and send the notification to any
// slaves.
LogUpdate llu;
for(;;)
{
try
{
DatabaseConnectionPtr connection = _connectionPool->newConnection();
TransactionHolder txn(connection);
for(Ice::IdentitySeq::const_iterator id = ids.begin(); id != ids.end(); ++id)
{
SubscriberRecordKey key;
key.topic = _id;
key.id = *id;
SubscribersWrapperPtr subscribersWrapper = _connectionPool->getSubscribers(connection);
subscribersWrapper->erase(key);
}
LLUWrapperPtr lluWrapper = _connectionPool->getLLU(connection);
llu = lluWrapper->get();
llu.iteration++;
lluWrapper->put(llu);
txn.commit();
break;
}
catch(const DeadlockException&)
{
continue;
}
catch(const DatabaseException& ex)
{
halt(_instance->communicator(), ex);
}
}
_instance->observers()->removeSubscriber(llu, _name, ids);
}