Skip to content

Instantly share code, notes, and snippets.

@zhammer
Created April 10, 2018 16:35
Show Gist options
  • Save zhammer/bf98f95302c82d525be98d7054e14abf to your computer and use it in GitHub Desktop.
Save zhammer/bf98f95302c82d525be98d7054e14abf to your computer and use it in GitHub Desktop.
// sourcereference_requestprocessor.cpp
void RequestProcessor::startReadyCheckScheduler()
{
d_scheduler.start();
bcema_SharedPtr<SubscriptionContext> ctxt(new SubscriptionContext(READYCHECK));
bdef_Function<void (*)()> timerHandle = bdef_BindUtil::bind(&delegate_, ctxt);
bdet_TimeInterval interval(CHECK_READY_INTERVAL_SECONDS);
d_scheduler.startClock(interval, timerHandle, bdetu_SystemTime::now());
}
// sourcereference_ticksizeimpl.cpp
bool sourcereference_ticksizeimpl::readyCheck()
{
BAEL_LOG_SET_CATEGORY("srcref.ticksizeimpl.readyCheck");
bool check = tickSizeCheckUp();
if(check)
{
BAEL_LOG_DEBUG<<"SRCREF SERVICE READY: ticksizes."<<BAEL_LOG_END;
rp_->ready();
}
else
{
BAEL_LOG_ERROR<<"SRCREF SERVICE NOT READY: ticksizes."<<BAEL_LOG_END;
rp_->notReady();
}
return check;
}
// sourcereference_ticksize.cpp
bool tickSizeCheckUp()
{
DBUtil dbutil;
std::vector<BPipeExchange> exchs;
exbyte_t exbyte = 0;
int returnCode = dbutil.getBPipeExchange_sTag(exbyte, exchs);
return returnCode != Ticksize::DBUtil::DB_CONN_ERROR;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment