public class JMXEnabledThreadPoolExecutor extends ThreadPoolExecutor implements JMXEnabledThreadPoolExecutorMBean
ThreadPoolExecutor which expose statistics via JMXThreadPoolExecutor.AbortPolicy, ThreadPoolExecutor.CallerRunsPolicy, ThreadPoolExecutor.DiscardOldestPolicy, ThreadPoolExecutor.DiscardPolicy| Constructor and Description |
|---|
JMXEnabledThreadPoolExecutor(int corePoolSize,
int maximumPoolSize,
long keepAliveTime,
TimeUnit unit,
BlockingQueue<Runnable> queue,
NamedThreadFactory tFactory,
String jmxPath) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
afterExecute(Runnable r,
Throwable t) |
protected void |
beforeExecute(Thread t,
Runnable r) |
int |
getActiveTasks()
Return the active Tasks
|
int |
getActiveThreads()
Return the active threads
|
double |
getAverageTaskTime()
Return the average time for a task (in ms)
|
int |
getMaximalThreads()
Return the maximal allowed count of threads
|
int |
getQueuedTasks()
Return the queued tasks
|
int |
getTotalTasks()
Return the total tasks handled by this executor
|
static JMXEnabledThreadPoolExecutor |
newCachedThreadPool(String jmxPath,
NamedThreadFactory factory)
Create a cached instance of this class.
|
static JMXEnabledThreadPoolExecutor |
newCachedThreadPool(String jmxPath,
String name)
Create a cached instance of this class.
|
static JMXEnabledThreadPoolExecutor |
newFixedThreadPool(String jmxPath,
int nThreads,
NamedThreadFactory threadFactory) |
static JMXEnabledThreadPoolExecutor |
newFixedThreadPool(String jmxPath,
String name,
int nThreads) |
void |
shutdown() |
List<Runnable> |
shutdownNow() |
allowCoreThreadTimeOut, allowsCoreThreadTimeOut, awaitTermination, execute, finalize, getActiveCount, getCompletedTaskCount, getCorePoolSize, getKeepAliveTime, getLargestPoolSize, getMaximumPoolSize, getPoolSize, getQueue, getRejectedExecutionHandler, getTaskCount, getThreadFactory, isShutdown, isTerminated, isTerminating, prestartAllCoreThreads, prestartCoreThread, purge, remove, setCorePoolSize, setKeepAliveTime, setMaximumPoolSize, setRejectedExecutionHandler, setThreadFactory, terminated, toStringinvokeAll, invokeAll, invokeAny, invokeAny, newTaskFor, newTaskFor, submit, submit, submitpublic JMXEnabledThreadPoolExecutor(int corePoolSize,
int maximumPoolSize,
long keepAliveTime,
TimeUnit unit,
BlockingQueue<Runnable> queue,
NamedThreadFactory tFactory,
String jmxPath)
protected void beforeExecute(Thread t, Runnable r)
beforeExecute in class ThreadPoolExecutorprotected void afterExecute(Runnable r, Throwable t)
afterExecute in class ThreadPoolExecutorpublic void shutdown()
shutdown in interface ExecutorServiceshutdown in class ThreadPoolExecutorpublic List<Runnable> shutdownNow()
shutdownNow in interface ExecutorServiceshutdownNow in class ThreadPoolExecutorpublic int getTotalTasks()
JMXEnabledThreadPoolExecutorMBeangetTotalTasks in interface JMXEnabledThreadPoolExecutorMBeanJMXEnabledThreadPoolExecutorMBean.getTotalTasks()public double getAverageTaskTime()
JMXEnabledThreadPoolExecutorMBeangetAverageTaskTime in interface JMXEnabledThreadPoolExecutorMBeanJMXEnabledThreadPoolExecutorMBean.getAverageTaskTime()public int getActiveThreads()
JMXEnabledThreadPoolExecutorMBeangetActiveThreads in interface JMXEnabledThreadPoolExecutorMBeanJMXEnabledThreadPoolExecutorMBean.getActiveThreads()public int getActiveTasks()
JMXEnabledThreadPoolExecutorMBeangetActiveTasks in interface JMXEnabledThreadPoolExecutorMBeanJMXEnabledThreadPoolExecutorMBean.getActiveTasks()public int getQueuedTasks()
JMXEnabledThreadPoolExecutorMBeangetQueuedTasks in interface JMXEnabledThreadPoolExecutorMBeanJMXEnabledThreadPoolExecutorMBean.getQueuedTasks()public int getMaximalThreads()
JMXEnabledThreadPoolExecutorMBeangetMaximalThreads in interface JMXEnabledThreadPoolExecutorMBeanJMXEnabledThreadPoolExecutorMBean.getMaximalThreads()public static JMXEnabledThreadPoolExecutor newCachedThreadPool(String jmxPath, String name)
MBeanServerjmxPath - name - public static JMXEnabledThreadPoolExecutor newCachedThreadPool(String jmxPath, NamedThreadFactory factory)
MBeanServerjmxPath - factory - public static JMXEnabledThreadPoolExecutor newFixedThreadPool(String jmxPath, int nThreads, NamedThreadFactory threadFactory)
public static JMXEnabledThreadPoolExecutor newFixedThreadPool(String jmxPath, String name, int nThreads)
Copyright © 2002-2012 The Apache Software Foundation. All Rights Reserved.