当前位置: 首页>>代码示例>>C++>>正文


C++ PtrLList::getCount方法代码示例

本文整理汇总了C++中PtrLList::getCount方法的典型用法代码示例。如果您正苦于以下问题:C++ PtrLList::getCount方法的具体用法?C++ PtrLList::getCount怎么用?C++ PtrLList::getCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PtrLList的用法示例。


在下文中一共展示了PtrLList::getCount方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: rsrm

/*
   send ReplicationStartReqMsg
   if send error delete self
   wait for ReplicationStartReplyMsg as follows
      loop until reply is received
          on receive error or peerNode dies, delete self
   get filtered list of messages to replicate
   for all messages to send, loop
       if clear to send
          send next message
          if send error, delete self
       else wait for clear to send (watch out for deadPeer?)
    all done delete self

    note: deleting self signals thread's parent to terminate this thread
          go through the list of successfully send and ack'd?
          and possibly queue up another session?
              
*/
void TargetBasedReplicationController::ReplicationSessionThread::run (void)
{
    int rc;
    const char *pszMethod = "TargetBasedReplicationController::ReplicationSessionThread::run";

    // First - send the ReplicationStartReqMsg
    ReplicationStartReqMsg rsrm (_localNodeID, _targetNodeID, TargetBasedReplicationController::CONTROLLER_TYPE, TargetBasedReplicationController::CONTROLLER_VERSION, _bCheckTargetForMsgs, _bRequireAcks);

    if (_pTBRepCtlr->transmitCtrlToCtrlMessage (&rsrm, "TargetBasedReplicationController: sending ReplicationStartReqMsg") != 0) {
        checkAndLogMsg (pszMethod, Logger::L_MildError,
                        "transmission of ReplicationStartReqMsg failed - terminating replication session\n");
        _pTBRepCtlr->addTerminatingReplicator (this);
        setTerminatingResultCode (-1);
        terminating();
        return;
    }
    else {
        checkAndLogMsg (pszMethod, Logger::L_Info,
                        "transmitted ReplicationStartReqMsg to target node %s\n",
                        (const char*) _targetNodeID);
    }

    // Wait for the ReplicationStartReplyMsg
    _m.lock();
    while (!_bReplicating) {
        if (terminationRequested()) {
            _pTBRepCtlr->addTerminatingReplicator (this);
            setTerminatingResultCode (-2);
            terminating();
            _m.unlock();
            return;
        }
        else if (_bTargetDead) {
            checkAndLogMsg (pszMethod, Logger::L_Warning,
                            "target node %s died while waiting for the ReplicationStartReplyMsg\n",
                            (const char*) _targetNodeID);
            _pTBRepCtlr->addTerminatingReplicator (this);
            setTerminatingResultCode (-3);
            terminating();
            _m.unlock();
            return;
        }
        _cv.wait (1000);
    }
    _m.unlock();

    // Ready to replicate messages at this point
    if ((_pMsgsToExclude != NULL) && (_pMsgsToExclude->getCount() > 0)) {
        checkAndLogMsg (pszMethod, Logger::L_Info,
                        "adding constraint to exclude messages previously received by node %s\n", (const char*) _targetNodeID);
    }

    int64 i64QueryStartTime = getTimeInMilliseconds();
    PtrLList<MessageId> *pMsgIds = _pTBRepCtlr->_pDataCacheInterface->getNotReplicatedMsgList (_targetNodeID, 0, _pMsgsToExclude);
    if (pMsgIds != NULL) {
        checkAndLogMsg (pszMethod, Logger::L_Info,
                        "identified %lu messages to replicate to node %s - query time %lu ms\n",
                        (uint32) pMsgIds->getCount(), (const char*) _targetNodeID, (uint32) (getTimeInMilliseconds() - i64QueryStartTime));
        for (MessageId *pMIdTemp = pMsgIds->getFirst(); pMIdTemp; pMIdTemp = pMsgIds->getNext()) {
            // Check for termination
            if (terminationRequested()) {
                setTerminatingResultCode (-4);
                break;
            }

            // Check Flow Control and target peer death
            int64 i64PauseStartTime = 0;
            while ((!_bTargetDead) && (!_pTBRepCtlr->clearToSendOnAllInterfaces())) {
                if (i64PauseStartTime == 0) {
                    i64PauseStartTime = getTimeInMilliseconds();
                }
                sleepForMilliseconds (100);
            }
            if (_bTargetDead) {
                checkAndLogMsg (pszMethod, Logger::L_Warning,
                                "target %s died while replicating messages\n",
                                (const char*) _targetNodeID);
                setTerminatingResultCode (-5);
                break;
            }
            if (i64PauseStartTime != 0) {
//.........这里部分代码省略.........
开发者ID:agilecomputing,项目名称:nomads,代码行数:101,代码来源:TargetBasedReplicationController.cpp


注:本文中的PtrLList::getCount方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。