Class BlockingDrainingQueue<T>

  • Type Parameters:
    T - The type of the items in the queue.

    @ThreadSafe
    public class BlockingDrainingQueue<T>
    extends AbstractDrainingQueue<T>
    Single-priority implementation for AbstractDrainingQueue. All items in this queue are treated fairly (there is no priority level assigned or accepted for queue items).
    • Constructor Detail

      • BlockingDrainingQueue

        public BlockingDrainingQueue()
        Creates a new instance of the BlockingDrainingQueue class.
    • Method Detail

      • addInternal

        protected void addInternal​(T item)
        Description copied from class: AbstractDrainingQueue
        Updates the internal data structure to include the given item. NOTE: this is invoked while holding the lock. There is no need for additional synchronization in the implementation.
        Specified by:
        addInternal in class AbstractDrainingQueue<T>
        Parameters:
        item - The item to include.
      • sizeInternal

        protected int sizeInternal()
        Description copied from class: AbstractDrainingQueue
        Returns the size of the queue. NOTE: this is invoked while holding the lock. There is no need for additional synchronization in the implementation.
        Specified by:
        sizeInternal in class AbstractDrainingQueue<T>
        Returns:
        The size of the queue.
      • fetch

        protected java.util.Queue<T> fetch​(int maxCount)
        Description copied from class: AbstractDrainingQueue
        Extracts a number of items from the queue. NOTE: this is invoked while holding the lock. There is no need for additional synchronization in the implementation.
        Specified by:
        fetch in class AbstractDrainingQueue<T>
        Parameters:
        maxCount - The maximum number of items to extract.
        Returns:
        The extracted items, in order.