@Override public long getNumberOfFreeThreads() { if (realExecutor instanceof JBossThreadPoolExecutor) { return ((JBossThreadPoolExecutor) realExecutor).getMaximumPoolSize() - ((JBossThreadPoolExecutor) realExecutor).getActiveCount(); } else if (realExecutor instanceof ThreadPoolExecutorMBean) { return ((ThreadPoolExecutorMBean) realExecutor).getMaxThreads() - ((ThreadPoolExecutorMBean) realExecutor).getCurrentThreadCount(); } else if (realExecutor instanceof ManagedQueueExecutorService) { return ((ManagedQueueExecutorService) realExecutor).getMaxThreads() - ((ManagedQueueExecutorService) realExecutor).getCurrentThreadCount(); } else if (realExecutor instanceof ManagedJBossThreadPoolExecutorService) { return ((ManagedJBossThreadPoolExecutorService) realExecutor).getMaxThreads() - ((ManagedJBossThreadPoolExecutorService) realExecutor).getCurrentThreadCount(); } else if (realExecutor instanceof ManagedQueuelessExecutorService) { return ((ManagedQueuelessExecutorService) realExecutor).getMaxThreads() - ((ManagedQueuelessExecutorService) realExecutor).getCurrentThreadCount(); } else if (realExecutor instanceof ManagedScheduledExecutorService) { return ((ManagedScheduledExecutorService) realExecutor).getLargestPoolSize() - ((ManagedScheduledExecutorService) realExecutor).getActiveCount(); } else { return 0; } } }
public int getActiveCount() { return executor.getActiveCount(); }
@Override public long getNumberOfFreeThreads() { if (realExecutor instanceof JBossThreadPoolExecutor) { return ((JBossThreadPoolExecutor) realExecutor).getMaximumPoolSize() - ((JBossThreadPoolExecutor) realExecutor).getActiveCount(); } else if (realExecutor instanceof ThreadPoolExecutorMBean) { return ((ThreadPoolExecutorMBean) realExecutor).getMaxThreads() - ((ThreadPoolExecutorMBean) realExecutor).getCurrentThreadCount(); } else { return 0; } } }
@Override public long getNumberOfFreeThreads() { if (realExecutor instanceof JBossThreadPoolExecutor) { return ((JBossThreadPoolExecutor) realExecutor).getMaximumPoolSize() - ((JBossThreadPoolExecutor) realExecutor).getActiveCount(); } else if (realExecutor instanceof ThreadPoolExecutorMBean) { return ((ThreadPoolExecutorMBean) realExecutor).getMaxThreads() - ((ThreadPoolExecutorMBean) realExecutor).getCurrentThreadCount(); } else if (realExecutor instanceof ManagedQueueExecutorService) { return ((ManagedQueueExecutorService) realExecutor).getMaxThreads() - ((ManagedQueueExecutorService) realExecutor).getCurrentThreadCount(); } else if (realExecutor instanceof ManagedJBossThreadPoolExecutorService) { return ((ManagedJBossThreadPoolExecutorService) realExecutor).getMaxThreads() - ((ManagedJBossThreadPoolExecutorService) realExecutor).getCurrentThreadCount(); } else if (realExecutor instanceof ManagedQueuelessExecutorService) { return ((ManagedQueuelessExecutorService) realExecutor).getMaxThreads() - ((ManagedQueuelessExecutorService) realExecutor).getCurrentThreadCount(); } else if (realExecutor instanceof ManagedScheduledExecutorService) { return ((ManagedScheduledExecutorService) realExecutor).getLargestPoolSize() - ((ManagedScheduledExecutorService) realExecutor).getActiveCount(); } else { return 0; } } }