Search in sources :

Example 1 with Args

use of org.apache.thrift.server.TThreadPoolServer.Args in project alluxio by Alluxio.

the class DefaultAlluxioMaster method startServingRPCServer.

protected void startServingRPCServer() {
    // set up multiplexed thrift processors
    TMultiplexedProcessor processor = new TMultiplexedProcessor();
    registerServices(processor, mBlockMaster.getServices());
    registerServices(processor, mFileSystemMaster.getServices());
    if (LineageUtils.isLineageEnabled()) {
        registerServices(processor, mLineageMaster.getServices());
    }
    // register additional masters for RPC service
    for (Master master : mAdditionalMasters) {
        registerServices(processor, master.getServices());
    }
    // register meta services
    processor.registerProcessor(Constants.META_MASTER_SERVICE_NAME, new MetaMasterClientService.Processor<>(new MetaMasterClientServiceHandler(this)));
    // Return a TTransportFactory based on the authentication type
    TTransportFactory transportFactory;
    try {
        transportFactory = mTransportProvider.getServerTransportFactory();
    } catch (IOException e) {
        throw Throwables.propagate(e);
    }
    // create master thrift service with the multiplexed processor.
    Args args = new TThreadPoolServer.Args(mTServerSocket).maxWorkerThreads(mMaxWorkerThreads).minWorkerThreads(mMinWorkerThreads).processor(processor).transportFactory(transportFactory).protocolFactory(new TBinaryProtocol.Factory(true, true));
    if (Configuration.getBoolean(PropertyKey.TEST_MODE)) {
        args.stopTimeoutVal = 0;
    } else {
        args.stopTimeoutVal = Constants.THRIFT_STOP_TIMEOUT_SECONDS;
    }
    mMasterServiceServer = new TThreadPoolServer(args);
    // start thrift rpc server
    mIsServing = true;
    mStartTimeMs = System.currentTimeMillis();
    mMasterServiceServer.serve();
}
Also used : BlockMaster(alluxio.master.block.BlockMaster) FileSystemMaster(alluxio.master.file.FileSystemMaster) LineageMaster(alluxio.master.lineage.LineageMaster) MetaMasterClientService(alluxio.thrift.MetaMasterClientService) Args(org.apache.thrift.server.TThreadPoolServer.Args) Args(org.apache.thrift.server.TThreadPoolServer.Args) TBinaryProtocol(org.apache.thrift.protocol.TBinaryProtocol) TMultiplexedProcessor(org.apache.thrift.TMultiplexedProcessor) TTransportFactory(org.apache.thrift.transport.TTransportFactory) IOException(java.io.IOException) TThreadPoolServer(org.apache.thrift.server.TThreadPoolServer)

Aggregations

BlockMaster (alluxio.master.block.BlockMaster)1 FileSystemMaster (alluxio.master.file.FileSystemMaster)1 LineageMaster (alluxio.master.lineage.LineageMaster)1 MetaMasterClientService (alluxio.thrift.MetaMasterClientService)1 IOException (java.io.IOException)1 TMultiplexedProcessor (org.apache.thrift.TMultiplexedProcessor)1 TBinaryProtocol (org.apache.thrift.protocol.TBinaryProtocol)1 TThreadPoolServer (org.apache.thrift.server.TThreadPoolServer)1 Args (org.apache.thrift.server.TThreadPoolServer.Args)1 TTransportFactory (org.apache.thrift.transport.TTransportFactory)1