/** * While starting the cache server stats can be monitored. */ private void startMonitor() { CacheServerStats stats = acceptor.getStats(); addCacheServerStats(stats); }
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; } }
private ExecutorService initializeClientQueueInitializerThreadPool() throws IOException { return LoggingExecutors.newThreadPoolWithSynchronousFeed("Client Queue Initialization Thread ", command -> { try { command.run(); } catch (CancelException e) { logger.debug("Client Queue Initialization was canceled.", e); } }, CLIENT_QUEUE_INITIALIZATION_POOL_SIZE, getStats().getCnxPoolHelper(), 60000, getThreadMonitorObj()); }
@Before public void setUp() throws Exception { synchronizing = Executors.newSingleThreadExecutor(); blocking = Executors.newSingleThreadExecutor(); latch = new CountDownLatch(1); cache = mock(InternalCache.class); cacheServer = mock(CacheServerImpl.class); acceptor = mock(AcceptorImpl.class); monitor = mock(MBeanStatsMonitor.class); when(cache.getQueryService()).thenReturn(mock(InternalQueryService.class)); when(acceptor.getStats()).thenReturn(mock(CacheServerStats.class)); }
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; } }
this.advisor.handshake(); this.loadMonitor.start(new ServerLocation(getExternalAddress(), getPort()), acceptor.getStats());