getExecutor().execute(new Runnable() { @Override public void run() {
/** * Initialize the endpoint. */ @Override public void bind() throws Exception { // Create worker collection if ( getExecutor() == null ) { createExecutor(); } if (getExecutor() instanceof ExecutorService) { threadGroup = AsynchronousChannelGroup.withThreadPool((ExecutorService) getExecutor()); } // AsynchronousChannelGroup currently needs exclusive access to its executor service if (!internalExecutor) { log.warn(sm.getString("endpoint.nio2.exclusiveExecutor")); } serverSock = AsynchronousServerSocketChannel.open(threadGroup); socketProperties.setProperties(serverSock); InetSocketAddress addr = (getAddress()!=null?new InetSocketAddress(getAddress(),getPort()):new InetSocketAddress(getPort())); serverSock.bind(addr,getAcceptCount()); // Initialize thread count defaults for acceptor, poller if (acceptorThreadCount != 1) { // NIO2 does not allow any form of IO concurrency acceptorThreadCount = 1; } // Initialize SSL if needed initialiseSsl(); }
/** * Start the NIO2 endpoint, creating acceptor. */ @Override public void startInternal() throws Exception { if (!running) { allClosed = false; running = true; paused = false; processorCache = new SynchronizedStack<>(SynchronizedStack.DEFAULT_SIZE, socketProperties.getProcessorCache()); nioChannels = new SynchronizedStack<>(SynchronizedStack.DEFAULT_SIZE, socketProperties.getBufferPool()); // Create worker collection if ( getExecutor() == null ) { createExecutor(); } initializeConnectionLatch(); startAcceptorThreads(); } }
if (launch) { try { getExecutor().execute(new SocketProcessor(socketWrapper, SocketEvent.OPEN_READ)); } catch (NullPointerException npe) { if (running) {