Class MonitoredQueuedThreadPool

All Implemented Interfaces:
Executor, ThreadFactory, Container, Destroyable, Dumpable, Dumpable.DumpableContainer, LifeCycle, ThreadPool, ThreadPool.SizedThreadPool, TryExecutor, VirtualThreads.Configurable

@ManagedObject public class MonitoredQueuedThreadPool extends QueuedThreadPool

A QueuedThreadPool subclass that monitors its own activity by recording queue and task statistics.

  • Constructor Details

    • MonitoredQueuedThreadPool

      public MonitoredQueuedThreadPool()
    • MonitoredQueuedThreadPool

      public MonitoredQueuedThreadPool(int maxThreads)
    • MonitoredQueuedThreadPool

      public MonitoredQueuedThreadPool(int maxThreads, int minThreads, int idleTimeOut, BlockingQueue<Runnable> queue)
  • Method Details

    • execute

      public void execute(Runnable job)
      Specified by:
      execute in interface Executor
      Specified by:
      execute in interface TryExecutor
      Overrides:
      execute in class QueuedThreadPool
    • reset

      @ManagedOperation(value="resets the statistics", impact="ACTION") public void reset()
      Resets the statistics.
    • getTasks

      @ManagedAttribute("the number of tasks executed") public long getTasks()
      Returns:
      the number of tasks executed
    • getMaxBusyThreads

      @ManagedAttribute("the maximum number of busy threads") public int getMaxBusyThreads()
      Returns:
      the maximum number of busy threads
    • getMaxQueueSize

      @ManagedAttribute("the maximum task queue size") public int getMaxQueueSize()
      Returns:
      the maximum task queue size
    • getAverageQueueLatency

      @ManagedAttribute("the average time a task remains in the queue, in nanoseconds") public long getAverageQueueLatency()
      Returns:
      the average time a task remains in the queue, in nanoseconds
    • getMaxQueueLatency

      @ManagedAttribute("the maximum time a task remains in the queue, in nanoseconds") public long getMaxQueueLatency()
      Returns:
      the maximum time a task remains in the queue, in nanoseconds
    • getAverageTaskLatency

      @ManagedAttribute("the average task execution time, in nanoseconds") public long getAverageTaskLatency()
      Returns:
      the average task execution time, in nanoseconds
    • getMaxTaskLatency

      @ManagedAttribute("the maximum task execution time, in nanoseconds") public long getMaxTaskLatency()
      Returns:
      the maximum task execution time, in nanoseconds