int beBackoffSlotLength = (int) hiveConf .getTimeVar(HiveConf.ConfVars.HIVE_SERVER2_THRIFT_LOGIN_BEBACKOFF_SLOT_LENGTH, TimeUnit.MILLISECONDS); TThreadPoolServer.Args sargs = new TThreadPoolServer.Args(serverSocket).processorFactory(processorFactory) .transportFactory(transportFactory).protocolFactory(new TBinaryProtocol.Factory()) .inputProtocolFactory(new TBinaryProtocol.Factory(true, true, maxMessageSize, maxMessageSize))
public static ServerPort startThreadPoolServer(int port, TProcessor processor, String serverName, String threadName, int numThreads) throws TTransportException { // if port is zero, then we must bind to get the port number ServerSocket sock; try { sock = ServerSocketChannel.open().socket(); sock.setReuseAddress(true); sock.bind(new InetSocketAddress(port)); port = sock.getLocalPort(); } catch (IOException ex) { throw new TTransportException(ex); } TServerTransport transport = new TBufferedServerSocket(sock, 32 * 1024); TThreadPoolServer.Args options = new TThreadPoolServer.Args(transport); options.protocolFactory(ThriftUtil.protocolFactory()); options.transportFactory(ThriftUtil.transportFactory()); processor = new TServerUtils.TimedProcessor(processor, serverName, threadName); options.processorFactory(new ClientInfoProcessorFactory(processor)); return new ServerPort(new TThreadPoolServer(options), port); }
HiveConf.ConfVars.HIVE_SERVER2_THRIFT_LOGIN_BEBACKOFF_SLOT_LENGTH, TimeUnit.MILLISECONDS); TThreadPoolServer.Args sargs = new TThreadPoolServer.Args(serverSocket) .processorFactory(processorFactory).transportFactory(transportFactory) .protocolFactory(new TBinaryProtocol.Factory()) .inputProtocolFactory(new TBinaryProtocol.Factory(true, true, maxMessageSize, maxMessageSize))
int beBackoffSlotLength = (int) hiveConf .getTimeVar(HiveConf.ConfVars.HIVE_SERVER2_THRIFT_LOGIN_BEBACKOFF_SLOT_LENGTH, TimeUnit.MILLISECONDS); TThreadPoolServer.Args sargs = new TThreadPoolServer.Args(serverSocket).processorFactory(processorFactory) .transportFactory(transportFactory).protocolFactory(new TBinaryProtocol.Factory()) .inputProtocolFactory(new TBinaryProtocol.Factory(true, true, maxMessageSize, maxMessageSize))
HiveConf.ConfVars.HIVE_SERVER2_THRIFT_LOGIN_BEBACKOFF_SLOT_LENGTH, TimeUnit.MILLISECONDS); TThreadPoolServer.Args sargs = new TThreadPoolServer.Args(serverSocket) .processorFactory(processorFactory).transportFactory(transportFactory) .protocolFactory(new TBinaryProtocol.Factory()) .inputProtocolFactory(new TBinaryProtocol.Factory(true, true, maxMessageSize, maxMessageSize))
HiveConf.ConfVars.HIVE_SERVER2_THRIFT_LOGIN_BEBACKOFF_SLOT_LENGTH, TimeUnit.MILLISECONDS); TThreadPoolServer.Args sargs = new TThreadPoolServer.Args(serverSocket) .processorFactory(processorFactory).transportFactory(transportFactory) .protocolFactory(new TBinaryProtocol.Factory()) .inputProtocolFactory(new TBinaryProtocol.Factory(true, true, maxMessageSize, maxMessageSize))
HiveConf.ConfVars.HIVE_SERVER2_THRIFT_LOGIN_BEBACKOFF_SLOT_LENGTH, TimeUnit.MILLISECONDS); TThreadPoolServer.Args sargs = new TThreadPoolServer.Args(serverSocket) .processorFactory(processorFactory).transportFactory(transportFactory) .protocolFactory(new TBinaryProtocol.Factory()) .inputProtocolFactory(new TBinaryProtocol.Factory(true, true, maxMessageSize, maxMessageSize))
TTransportFactory transportFactory = new TFramedTransport.Factory(maxFrameSize); TThreadPoolServer.Args args = new TThreadPoolServer.Args(transport) .processorFactory(processorFactory).protocolFactory(protocolFactory) .transportFactory(transportFactory).minWorkerThreads(1) .maxWorkerThreads(maxWorkerThreads);
/** * Create a {@link TThreadPoolServer} with the provided server transport, processor and transport * factory. * * @param transport * TServerTransport for the server * @param processor * TProcessor for the server * @param transportFactory * TTransportFactory for the server */ public static TThreadPoolServer createTThreadPoolServer(TServerTransport transport, TProcessor processor, TTransportFactory transportFactory, TProtocolFactory protocolFactory, ExecutorService service) { TThreadPoolServer.Args options = new TThreadPoolServer.Args(transport); options.protocolFactory(protocolFactory); options.transportFactory(transportFactory); options.processorFactory(new ClientInfoProcessorFactory(clientAddress, processor)); if (null != service) { options.executorService(service); } return new TThreadPoolServer(options); }
/** * Create a {@link TThreadPoolServer} with the provided server transport, processor and transport * factory. * * @param transport * TServerTransport for the server * @param processor * TProcessor for the server * @param transportFactory * TTransportFactory for the server */ public static TThreadPoolServer createTThreadPoolServer(TServerTransport transport, TProcessor processor, TTransportFactory transportFactory, TProtocolFactory protocolFactory, ExecutorService service) { TThreadPoolServer.Args options = new TThreadPoolServer.Args(transport); options.protocolFactory(protocolFactory); options.transportFactory(transportFactory); options.processorFactory(new ClientInfoProcessorFactory(clientAddress, processor)); if (service != null) { options.executorService(service); } return new TThreadPoolServer(options); }