/** * @deprecated please use {@link ThreadPoolMonitoringProbe}s to intercept * thread pool events and build statistics. */ @Deprecated public int getActiveCount() { return pool.getActiveCount(); }
@SuppressWarnings("deprecation") protected ThreadPoolConfig updateFrom(ExtendedThreadPool ep) { this.queue = ep.getQueue(); this.threadFactory = ep.getThreadFactory(); this.poolName = ep.getName(); this.maxPoolSize = ep.getMaximumPoolSize(); //hiding internal values, due to they might not match configure //this.queueLimit = ep.getMaxQueuedTasksCount(); //this.corepoolsize = ep.getCorePoolSize(); //this.keepAliveTime = keepAliveTime; //this.timeUnit = timeUnit; //this.monitoringProbe = monitoringProbe; return this; }
/** * Gets the number of connections currently in the queue * * @return Number of connections currently in the queue */ public int getCountQueued() { int size = 0; if (threadPool != null && threadPool instanceof ExtendedThreadPool) { size = ((ExtendedThreadPool) threadPool).getQueueSize(); } return size; }
if ( useKeepAliveAlgorithm ) { float threadRatio = (float) st.getActiveCount() / (float) st.getMaximumPoolSize();
private ThreadFactory getThreadFactory(ExecutorService threadPool) { if (threadPool instanceof ExtendedThreadPool) { return ((ExtendedThreadPool) threadPool).getThreadFactory(); } else if (threadPool instanceof ThreadPoolExecutor) { return ((ThreadPoolExecutor) threadPool).getThreadFactory(); } return null; }
maxPoolSize = ((ExtendedThreadPool) threadPool).getMaximumPoolSize();
public boolean awaitTermination(long timeout, TimeUnit unit) throws InterruptedException { return pool.awaitTermination(timeout, unit); }
public void execute(Runnable r) { pool.execute(r); }
/** * @deprecated please use {@link ThreadPoolMonitoringProbe}s to intercept * thread pool events and build statistics. */ @Deprecated public long getCompletedTaskCount() { return pool.getCompletedTaskCount(); }
/** * @deprecated please use {@link ThreadPoolMonitoringProbe}s to intercept * thread pool events and build statistics. */ @Deprecated public int getLargestPoolSize() { return pool.getLargestPoolSize(); }
/** * Initialize the {@link ThreadPoolStatistic} instance. */ protected void initMonitoringLevel() { if (threadPoolStat != null) return; threadPoolStat = new ThreadPoolStatistic(port); int maxQueuedTasks = -1; if (threadPool instanceof ExtendedThreadPool) { maxQueuedTasks = ((ExtendedThreadPool) threadPool).getMaxQueuedTasksCount(); } threadPoolStat.setQueueSizeInBytes(maxQueuedTasks); }
/** * @deprecated please use {@link ThreadPoolMonitoringProbe}s to intercept * thread pool events and build statistics. */ @Deprecated public int getQueueSize() { return pool.getQueueSize(); }