private static ExecutorService createExecutor( int workerThreads, ThriftMetrics metrics) { CallQueue callQueue = new CallQueue( new LinkedBlockingQueue<Call>(), metrics); ThreadFactoryBuilder tfb = new ThreadFactoryBuilder(); tfb.setDaemon(true); tfb.setNameFormat("thrift2-worker-%d"); ThreadPoolExecutor pool = new ThreadPoolExecutor(workerThreads, workerThreads, Long.MAX_VALUE, TimeUnit.SECONDS, callQueue, tfb.build()); pool.prestartAllCoreThreads(); return pool; }
private static ExecutorService createExecutor( int workerThreads, ThriftMetrics metrics) { CallQueue callQueue = new CallQueue( new LinkedBlockingQueue<Call>(), metrics); ThreadFactoryBuilder tfb = new ThreadFactoryBuilder(); tfb.setDaemon(true); tfb.setNameFormat("thrift2-worker-%d"); return new ThreadPoolExecutor(workerThreads, workerThreads, Long.MAX_VALUE, TimeUnit.SECONDS, callQueue, tfb.build()); }