Class WorkQueueImpl

  • All Implemented Interfaces:
    WorkQueue

    public class WorkQueueImpl
    extends java.lang.Object
    implements WorkQueue
    • Field Detail

      • WORKQUEUE_DEFAULT_NAME

        public static final java.lang.String WORKQUEUE_DEFAULT_NAME
        See Also:
        Constant Field Values
      • queue

        private final java.util.Queue<Work> queue
      • workerThreadPool

        private ThreadPool workerThreadPool
      • workItemsAdded

        private long workItemsAdded
      • workItemsDequeued

        private long workItemsDequeued
      • totalTimeInQueue

        private long totalTimeInQueue
      • name

        private final java.lang.String name
    • Constructor Detail

      • WorkQueueImpl

        public WorkQueueImpl()
      • WorkQueueImpl

        public WorkQueueImpl​(ThreadPool workerThreadPool)
      • WorkQueueImpl

        public WorkQueueImpl​(ThreadPool workerThreadPool,
                             java.lang.String name)
    • Method Detail

      • getWorkQueueSize

        private int getWorkQueueSize()
      • addWork

        public void addWork​(Work work)
        Description copied from interface: WorkQueue
        This method is used to add work to the WorkQueue
        Specified by:
        addWork in interface WorkQueue
      • setThreadPool

        public void setThreadPool​(ThreadPool workerThreadPool)
        Description copied from interface: WorkQueue
        Set the ThreadPool instance servicing this WorkQueue
        Specified by:
        setThreadPool in interface WorkQueue
      • totalWorkItemsAdded

        @ManagedAttribute
        @Description("Total number of items added to the queue")
        public long totalWorkItemsAdded()
        Returns the total number of Work items added to the Queue.
        Specified by:
        totalWorkItemsAdded in interface WorkQueue
      • workItemsInQueue

        @ManagedAttribute
        @Description("Total number of items in the queue to be processed")
        public int workItemsInQueue()
        Returns the total number of Work items in the Queue to be processed.
        Specified by:
        workItemsInQueue in interface WorkQueue
      • averageTimeInQueue

        @ManagedAttribute
        @Description("Average time work items spend waiting in the queue in milliseconds")
        public long averageTimeInQueue()
        Returns the average amount Work items have spent in the Queue waiting to be processed.
        Specified by:
        averageTimeInQueue in interface WorkQueue
      • getName

        @NameValue
        public java.lang.String getName()
        Description copied from interface: WorkQueue
        This method will return the name of the WorkQueue.
        Specified by:
        getName in interface WorkQueue