コード例 #1
0
ファイル: AgentI.cpp プロジェクト: sinofool/xlog
void SendWorker::add(const slice::LogDataSeq& data)
{
    ::IceUtil::Monitor<IceUtil::Mutex>::Lock lock(_dataMutex);
     if(_data.size() == 2000)
     {
        std::cout << " cache data count : 2000 over memory limit! " << std::endl;
     }

    _data.insert(_data.end(), data.begin(), data.end());
    _dataMutex.notify();
}
コード例 #2
0
ファイル: client.cpp プロジェクト: zhan8610189/xlog
bool AsyncClient::doSend(const slice::LogDataSeq& data)
{
    ::IceUtil::Monitor<IceUtil::Mutex>::Lock lock(_dataMutex);
    if (_data.size() >= _maxQueueSize)
    {
        XLOG_ERROR("Client::append queue is full, maxQueueSize is " << _maxQueueSize);
        return false;
    }

    _data.insert(_data.end(), data.begin(), data.end());

    _dataMutex.notify();

    return true;
}
コード例 #3
0
ファイル: agent_adapter.cpp プロジェクト: zhan8610189/xlog
bool AgentAdapter::send(const slice::LogDataSeq& data)
{
    int size=agent_prxs.size();
    for(int i=0;i<size;i++)
    {
       try
       {
           getAgentPrx()->add(data);
           return true;
       } catch (::Ice::TimeoutException& e)
       {
           XLOG_WARN("AgentAdapter::send failed timeout in " << i+1  << " times, repeat again! The Exception: " << e);
       } catch (::Ice::Exception& e)
       {
           XLOG_WARN("AgentAdapter::send failed in " << i+1  << " times, repeat again! The Exception: " << e);
       }
    }
    XLOG_ERROR("AgentAdapter::send failed after " << size  << " times. The data size: " << data.size() << "." );
    return false;
}