private void init() { if (isInitialized) return; synchronized (this) { if (isInitialized) return; try { group = AsynchronousChannelGroup.withThreadPool( new ThreadPoolExecutor( config.getAsynchronousCorePoolSize(), config.getAsynchronousMaximumPoolSize(), config.getAsynchronousPoolKeepAliveTime(), TimeUnit.MILLISECONDS, new LinkedTransferQueue<Runnable>(), new ThreadFactory() { @Override public Thread newThread(Runnable r) { return new Thread(r, "firefly asynchronous server thread"); } })); log.info( "create asychronous I/O thread pool. core pool size: {}, max pool size: {}, pool keep alive time: {}ms", config.getAsynchronousCorePoolSize(), config.getAsynchronousMaximumPoolSize(), config.getAsynchronousPoolKeepAliveTime()); EventManager eventManager = new DefaultEventManager(config); worker = new AsynchronousTcpWorker(config, eventManager); } catch (IOException e) { log.error("initialization server channel group error", e); } isInitialized = true; } }