/** * The work loop of this acceptor * * @see #accept */ @Override public void run() { try { accept(); } catch (CancelException e) { // bug 39462 // ignore } finally { try { if (this.serverSock != null) { this.serverSock.close(); } } catch (IOException ignore) { } if (this.stats != null) { this.stats.close(); } } }
private ExecutorService initializeHandshakerThreadPool() throws IOException { String threadName = "Handshaker " + serverSock.getInetAddress() + ":" + this.localPort + " Thread "; try { logger.warn("Handshaker max Pool size: " + HANDSHAKE_POOL_SIZE); return LoggingExecutors.newThreadPoolWithSynchronousFeedThatHandlesRejection(threadName, thread -> getStats().incAcceptThreadsCreated(), null, 1, HANDSHAKE_POOL_SIZE, 60); } catch (IllegalArgumentException poolInitException) { this.stats.close(); this.serverSock.close(); this.pool.shutdown(); throw poolInitException; } }
this.clientNotifier.shutdown(this.acceptorId); shutdownPools(); this.stats.close(); if (!cache.isClosed()) {
private ExecutorService initializeServerConnectionThreadPool() throws IOException { String threadName = "ServerConnection on port " + this.localPort + " Thread "; ThreadInitializer threadInitializer = thread -> getStats().incConnectionThreadsCreated(); CommandWrapper commandWrapper = command -> { try { command.run(); } catch (CancelException e) { // bug 39463 // ignore } finally { ConnectionTable.releaseThreadsSockets(); } }; try { if (isSelector()) { return LoggingExecutors.newThreadPoolWithUnlimitedFeed(threadName, threadInitializer, commandWrapper, this.maxThreads, getStats().getCnxPoolHelper(), Integer.MAX_VALUE, getThreadMonitorObj()); } else { return LoggingExecutors.newThreadPoolWithSynchronousFeed(threadName, threadInitializer, commandWrapper, MINIMUM_MAX_CONNECTIONS, this.maxConnections, 0L); } } catch (IllegalArgumentException poolInitException) { this.stats.close(); this.serverSock.close(); throw poolInitException; } }