/** * Init the {@link StatsThreadPool}s used by the {@link WorkerThread}s. */ public void initThreadPool(){ if (threadPool == null) { threadPool = newThreadPool( Constants.DEFAULT_QUEUE_SIZE, "http", port, Thread.MAX_PRIORITY); } else { if (threadPool instanceof StatsThreadPool) { StatsThreadPool statsThreadPool = (StatsThreadPool) threadPool; statsThreadPool.setPort(port); statsThreadPool.setPriority(Thread.MAX_PRIORITY); } if (threadPool instanceof ExtendedThreadPool) { ExtendedThreadPool extThreadPool = (ExtendedThreadPool) threadPool; extThreadPool.setCorePoolSize(coreThreads); extThreadPool.setMaximumPoolSize(maxThreads); } } if (isMonitoringEnabled){ enableThreadPoolStats(); } }
ExtendedThreadPool extThreadPool = (ExtendedThreadPool) threadPool; extThreadPool.setCorePoolSize(coreThreads); extThreadPool.setMaximumPoolSize(maxThreads); extThreadPool.setName(name);