void TNonblockingServer::setThreadManager(stdcxx::shared_ptr<ThreadManager> threadManager) {
  threadManager_ = threadManager;
  if (threadManager) {
    threadManager->setExpireCallback(
        apache::thrift::stdcxx::bind(&TNonblockingServer::expireClose,
                                     this,
                                     apache::thrift::stdcxx::placeholders::_1));
    threadPoolProcessing_ = true;
  } else {
    threadPoolProcessing_ = false;
  }
}
void TNonblockingServer::expireClose(stdcxx::shared_ptr<Runnable> task) {
  TConnection* connection = static_cast<TConnection::Task*>(task.get())->getTConnection();
  assert(connection && connection->getServer() && connection->getState() == APP_WAIT_TASK);
  connection->forceClose();
}
Exemplo n.º 3
0
TJSONProtocol::TJSONProtocol(stdcxx::shared_ptr<TTransport> ptrans)
  : TVirtualProtocol<TJSONProtocol>(ptrans),
    trans_(ptrans.get()),
    context_(new TJSONContext()),
    reader_(*ptrans) {
}