Пример #1
0
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
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
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;
}