.protocolFactory(protocolFactory) .inputProtocolFactory(inputProtoFactory) .minWorkerThreads(minWorkerThreads) .maxWorkerThreads(maxWorkerThreads);
@Override public TServer getServer(TProcessor processor) throws IOException, TTransportException { int port = type.getPort(storm_conf); TTransportFactory serverTransportFactory = getServerTransportFactory(); TServerSocket serverTransport = new TServerSocket(port); int numWorkerThreads = type.getNumThreads(storm_conf); Integer queueSize = type.getQueueSize(storm_conf); TThreadPoolServer.Args server_args = new TThreadPoolServer.Args(serverTransport).processor(new TUGIWrapProcessor(processor)).minWorkerThreads(numWorkerThreads) .maxWorkerThreads(numWorkerThreads).protocolFactory(new TBinaryProtocol.Factory(false, true)); if (serverTransportFactory != null) { server_args.transportFactory(serverTransportFactory); } BlockingQueue workQueue = new SynchronousQueue(); if (queueSize != null) { workQueue = new ArrayBlockingQueue(queueSize); } ThreadPoolExecutor executorService = new ExtendedThreadPoolExecutor(numWorkerThreads, numWorkerThreads, 60, TimeUnit.SECONDS, workQueue); server_args.executorService(executorService); return new TThreadPoolServer(server_args); }
.transportFactory(transportFactory) .protocolFactory(new TBinaryProtocol.Factory(true, true, maxMessageSize, maxMessageSize)) .minWorkerThreads(minThreads).maxWorkerThreads(maxThreads); thriftServer = new TThreadPoolServer(args); LOGGER.info("Serving on " + address);
.protocolFactory(protocolFactory) .inputProtocolFactory(inputProtoFactory) .minWorkerThreads(minWorkerThreads) .maxWorkerThreads(maxWorkerThreads);
.protocolFactory(protocolFactory) .inputProtocolFactory(inputProtoFactory) .minWorkerThreads(minWorkerThreads) .maxWorkerThreads(maxWorkerThreads);
.protocolFactory(protocolFactory) .inputProtocolFactory(inputProtoFactory) .minWorkerThreads(minWorkerThreads) .maxWorkerThreads(maxWorkerThreads);
.transportFactory(transFactory) .protocolFactory(new TBinaryProtocol.Factory()) .minWorkerThreads(minWorkerThreads) .maxWorkerThreads(maxWorkerThreads);
.transportFactory(transportFactory) .protocolFactory(new TBinaryProtocol.Factory(true, true, maxMessageSize, maxMessageSize)) .minWorkerThreads(minThreads).maxWorkerThreads(maxThreads); thriftServer = new TThreadPoolServer(args); LOGGER.info("Serving on {}", address);
.transportFactory(transFactory) .protocolFactory(new TBinaryProtocol.Factory()) .minWorkerThreads(minWorkerThreads) .maxWorkerThreads(maxWorkerThreads);
.minWorkerThreads(DatabaseDescriptor.getRpcMinThreads()) .maxWorkerThreads(DatabaseDescriptor.getRpcMaxThreads()) .inputTransportFactory(args.inTransportFactory)
.transportFactory(transFactory) .protocolFactory(new TBinaryProtocol.Factory()) .minWorkerThreads(minWorkerThreads) .maxWorkerThreads(maxWorkerThreads);
.minWorkerThreads(DatabaseDescriptor.getRpcMinThreads()) .maxWorkerThreads(DatabaseDescriptor.getRpcMaxThreads()) .inputTransportFactory(inTransportFactory)
.minWorkerThreads(DatabaseDescriptor.getRpcMinThreads()) .maxWorkerThreads(DatabaseDescriptor.getRpcMaxThreads()) .inputTransportFactory(args.inTransportFactory)
.minWorkerThreads(DatabaseDescriptor.getRpcMinThreads()) .maxWorkerThreads(DatabaseDescriptor.getRpcMaxThreads()) .inputTransportFactory(args.inTransportFactory)
.minWorkerThreads(mMinWorkerThreads) .processor(processor) .transportFactory(transportFactory)
protected void startServingRPCServer() { // set up multiplexed thrift processors TMultiplexedProcessor processor = new TMultiplexedProcessor(); processor.registerProcessor(mBlockMaster.getServiceName(), mBlockMaster.getProcessor()); processor.registerProcessor(mFileSystemMaster.getServiceName(), mFileSystemMaster.getProcessor()); processor.registerProcessor(mRawTableMaster.getServiceName(), mRawTableMaster.getProcessor()); if (LineageUtils.isLineageEnabled(MasterContext.getConf())) { processor.registerProcessor(mLineageMaster.getServiceName(), mLineageMaster.getProcessor()); } // Return a TTransportFactory based on the authentication type TTransportFactory transportFactory; try { transportFactory = AuthenticationUtils.getServerTransportFactory(MasterContext.getConf()); } catch (IOException ioe) { throw Throwables.propagate(ioe); } // create master thrift service with the multiplexed processor. mMasterServiceServer = new TThreadPoolServer(new TThreadPoolServer.Args(mTServerSocket) .maxWorkerThreads(mMaxWorkerThreads).minWorkerThreads(mMinWorkerThreads) .processor(processor).transportFactory(transportFactory) .protocolFactory(new TBinaryProtocol.Factory(true, true))); // start thrift rpc server mIsServing = true; mStartTimeMs = System.currentTimeMillis(); mMasterServiceServer.serve(); }
TThreadPoolServer.Args args = new TThreadPoolServer.Args(transport) .processorFactory(processorFactory).protocolFactory(protocolFactory) .transportFactory(transportFactory).minWorkerThreads(1) .maxWorkerThreads(maxWorkerThreads); TThreadPoolServer server = new TThreadPoolServer(args);
/** * Helper method to create a {@link org.apache.thrift.server.TThreadPoolServer} for handling * incoming RPC requests. * * @return a thrift server */ private TThreadPoolServer createThriftServer() { int minWorkerThreads = mTachyonConf.getInt(Constants.WORKER_WORKER_BLOCK_THREADS_MIN); int maxWorkerThreads = mTachyonConf.getInt(Constants.WORKER_WORKER_BLOCK_THREADS_MAX); WorkerService.Processor<BlockServiceHandler> processor = new WorkerService.Processor<BlockServiceHandler>(mServiceHandler); TTransportFactory tTransportFactory; try { tTransportFactory = AuthenticationUtils.getServerTransportFactory(mTachyonConf); } catch (IOException ioe) { throw Throwables.propagate(ioe); } return new TThreadPoolServer(new TThreadPoolServer.Args(mThriftServerSocket) .minWorkerThreads(minWorkerThreads).maxWorkerThreads(maxWorkerThreads).processor(processor) .transportFactory(tTransportFactory) .protocolFactory(new TBinaryProtocol.Factory(true, true))); }
private TServer thriftServer() throws IOException, TTransportException, MetaException, InvocationTargetException, NoSuchMethodException, IllegalAccessException, NoSuchFieldException { final TServerSocketKeepAlive socket = new TServerSocketKeepAlive(new TServerSocket(0)); this.hiveConf = hiveConf(new Configuration(), socket.getServerSocket().getLocalPort()); HiveMetaStore.HMSHandler baseHandler = new HiveMetaStore.HMSHandler("new db based metaserver", hiveConf); IHMSHandler handler = RetryingHMSHandler.getProxy(hiveConf, baseHandler, true); final TTransportFactory transportFactory = new TTransportFactory(); final TSetIpAddressProcessor<IHMSHandler> processor = new TSetIpAddressProcessor<>(handler); TThreadPoolServer.Args args = new TThreadPoolServer.Args(socket) .processor(processor) .transportFactory(transportFactory) .protocolFactory(new TBinaryProtocol.Factory()) .minWorkerThreads(3) .maxWorkerThreads(5); return new TThreadPoolServer(args); }