private void initThriftServer ( ) throws TTransportException , FatalChronosException , ChronosException { int maxThread = Integer . parseInt ( properties . getProperty ( MAX_THREAD , String . valueOf ( Integer . MAX_VALUE ) ) ) ; String serverHost = properties . getProperty ( FailoverServer . SERVER_HOST ) ; int serverPort = Integer . parseInt ( properties . getProperty ( FailoverServer . SERVER_PORT ) ) ; TServerSocket serverTransport = new TServerSocket ( new InetSocketAddress ( serverHost , serverPort ) ) ; Factory proFactory = new TBinaryProtocol . Factory ( ) ; chronosImplement = new ChronosImplement ( properties , chronosServerWatcher ) ; TProcessor processor = new ChronosService . Processor ( chronosImplement ) ; Args rpcArgs = new Args ( serverTransport ) ; rpcArgs . processor ( processor ) ; rpcArgs . protocolFactory ( proFactory ) ; rpcArgs . maxWorkerThreads ( maxThread ) ; thriftServer = new TThreadPoolServer ( rpcArgs ) ; }
Initialize Thrift server of ChronosServer .