.minWorkerThreads(numWorkerThreads) .maxWorkerThreads(numWorkerThreads) .protocolFactory(new TBinaryProtocol.Factory(false, true));
@Override public TServer getServer(TProcessor processor) throws IOException, TTransportException { int port = type.getPort(storm_conf); Integer socketTimeout = type.getSocketTimeOut(storm_conf); TTransportFactory serverTransportFactory = getServerTransportFactory(type.isImpersonationAllowed()); TServerSocket serverTransport = null; if (socketTimeout != null) { serverTransport = new TServerSocket(port, socketTimeout); } else { 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); }
@Override public TServer getServer(TProcessor processor) throws IOException, TTransportException { int port = type.getPort(storm_conf); TNonblockingServerSocket serverTransport = new TNonblockingServerSocket(port); int numWorkerThreads = type.getNumThreads(storm_conf); int maxBufferSize = type.getMaxBufferSize(storm_conf); Integer queueSize = type.getQueueSize(storm_conf); THsHaServer.Args server_args = new THsHaServer.Args(serverTransport). processor(new SimpleWrapProcessor(processor)). maxWorkerThreads(numWorkerThreads). protocolFactory(new TBinaryProtocol.Factory(false, true, maxBufferSize, -1)); server_args.maxReadBufferBytes = maxBufferSize; if (queueSize != null) { server_args.executorService(new ThreadPoolExecutor(numWorkerThreads, numWorkerThreads, 60, TimeUnit.SECONDS, new ArrayBlockingQueue(queueSize))); } //construct THsHaServer return new THsHaServer(server_args); }
@Override public TServer getServer(TProcessor processor) throws IOException, TTransportException { int configuredPort = type.getPort(topoConf); TNonblockingServerSocket serverTransport = new TNonblockingServerSocket(configuredPort); this.port = serverTransport.getPort(); int numWorkerThreads = type.getNumThreads(topoConf); int maxBufferSize = type.getMaxBufferSize(topoConf); Integer queueSize = type.getQueueSize(topoConf); THsHaServer.Args server_args = new THsHaServer.Args(serverTransport). processor(new SimpleWrapProcessor(processor)). maxWorkerThreads(numWorkerThreads). protocolFactory( new TBinaryProtocol.Factory(false, true, maxBufferSize, -1)); server_args.maxReadBufferBytes = maxBufferSize; if (queueSize != null) { server_args.executorService(new ThreadPoolExecutor(numWorkerThreads, numWorkerThreads, 60, TimeUnit.SECONDS, new ArrayBlockingQueue(queueSize))); } //construct THsHaServer return new THsHaServer(server_args); }