@ManagedObject public class MonitoredQueuedThreadPool extends QueuedThreadPool
A QueuedThreadPool
subclass that monitors its own activity by recording queue and task statistics.
AbstractLifeCycle.AbstractLifeCycleListener
ThreadPool.SizedThreadPool
TryExecutor.NoTryExecutor
Container.InheritedListener, Container.Listener
LifeCycle.Listener
Modifier and Type | Field and Description |
---|---|
private SampleStatistic |
queueLatencyStats |
private CounterStatistic |
queueStats |
private SampleStatistic |
taskLatencyStats |
private CounterStatistic |
threadStats |
FAILED, RUNNING, STARTED, STARTING, STOP_ON_FAILURE, STOPPED, STOPPING
NO_TRY
Constructor and Description |
---|
MonitoredQueuedThreadPool() |
MonitoredQueuedThreadPool(int maxThreads) |
Modifier and Type | Method and Description |
---|---|
void |
execute(java.lang.Runnable job) |
long |
getAverageQueueLatency() |
long |
getAverageTaskLatency() |
int |
getMaxBusyThreads() |
long |
getMaxQueueLatency() |
int |
getMaxQueueSize() |
long |
getMaxTaskLatency() |
long |
getTasks() |
void |
reset()
Resets the statistics.
|
doStart, doStop, dump, dumpThread, getBusyThreads, getIdleThreads, getIdleTimeout, getLowThreadsThreshold, getMaxThreads, getMinThreads, getName, getQueue, getQueueSize, getReservedThreads, getThreadPoolBudget, getThreads, getThreadsPriority, interruptThread, isDaemon, isDetailedDump, isLowOnThreads, join, newThread, removeThread, runJob, setDaemon, setDetailedDump, setIdleTimeout, setLowThreadsThreshold, setMaxThreads, setMinThreads, setName, setQueue, setReservedThreads, setThreadPoolBudget, setThreadsPriority, toString, tryExecute
addBean, addBean, addBean, addEventListener, addManaged, contains, destroy, dump, dump, dump, dump, dumpBeans, dumpObject, dumpStdErr, dumpThis, getBean, getBeans, getBeans, getContainedBeans, getContainedBeans, isManaged, manage, removeBean, removeBeans, removeEventListener, setBeans, setStopTimeout, start, stop, unmanage, updateBean, updateBean, updateBeans
addLifeCycleListener, getState, getState, getStopTimeout, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
asTryExecutor
private final CounterStatistic queueStats
private final SampleStatistic queueLatencyStats
private final SampleStatistic taskLatencyStats
private final CounterStatistic threadStats
public MonitoredQueuedThreadPool()
public MonitoredQueuedThreadPool(int maxThreads)
public void execute(java.lang.Runnable job)
execute
in interface java.util.concurrent.Executor
execute
in interface TryExecutor
execute
in class QueuedThreadPool
@ManagedOperation(value="resets the statistics", impact="ACTION") public void reset()
@ManagedAttribute(value="the number of tasks executed") public long getTasks()
@ManagedAttribute(value="the maximum number of busy threads") public int getMaxBusyThreads()
@ManagedAttribute(value="the maximum task queue size") public int getMaxQueueSize()
@ManagedAttribute(value="the average time a task remains in the queue, in nanoseconds") public long getAverageQueueLatency()
@ManagedAttribute(value="the maximum time a task remains in the queue, in nanoseconds") public long getMaxQueueLatency()
@ManagedAttribute(value="the average task execution time, in nanoseconds") public long getAverageTaskLatency()
@ManagedAttribute(value="the maximum task execution time, in nanoseconds") public long getMaxTaskLatency()