1#include "NetDataReader/DimRpcReader.h"
2#include "ClientErrHandler/ClientErrHandler.h"
3#include "DistBossUtil/AutoEnlargeBuffer.h"
4#include "DistBossUtil/DistBossCode.h"
5#include "IRawFile/RawFileExceptions.h"
9pthread_mutex_t DimRpcReader::m_rpcLock = PTHREAD_MUTEX_INITIALIZER;
14 throw RawExMessage(
"[NetDataReader] The name of DistBoss EvtServer was not set!");
36 for (
int i = 1; i < 7; ++i ) {
37 pthread_mutex_lock( &m_rpcLock );
40 m_rpc->setData(m_outCode);
41 int size = m_rpc->getSize();
42 void*
data = m_rpc->getData();
45 pthread_mutex_unlock( &m_rpcLock );
48 return (
const uint32_t*)m_buffer->
data();
50 else if ( size == 4 ) {
51 m_inCode = *((
const uint32_t*)m_buffer->
data());
53 throw RawExMessage(
"[NetDataReader] Reach the end, no more events left.");
58 std::cout <<
"[NetDataReader] Event " << nn <<
" timeout. Sleep " << sec <<
"s before retry." << std::endl;
60 std::cout <<
"[NetDataReader] Event " << nn <<
" now retry time " << i <<
" ..." << std::endl;
65 throw RawExMessage(
"[NetDataReader] Failed to retry server. Stop this client!");
69 throw RawExMessage(
"[NetDataReader] DistBossServer ERROR !!!");
72 throw RawExMessage(
"[NetDataReader] Unknown server code !!!");
76 throw RawExMessage(
"[NetDataReader] Invalid data from server !!!");
87 return (
const uint32_t*)m_buffer->
data();
99 pthread_mutex_lock( &m_rpcLock );
102 m_rpc->setData(m_outCode);
104 std::string fname((
char*)m_rpc->getData());
106 pthread_mutex_unlock( &m_rpcLock );
void copy(void *src, int size)
static void registerInstance()
DimRpcReader(ReaderArgType &name)
const uint32_t * nextEvent()
const uint32_t * currentEvent() const
std::string currentFile()
const std::string ReaderArgType