Class AbstractBlockingTaskQueue

java.lang.Object
org.jbrew.concurrent.AbstractBlockingTaskQueue
All Implemented Interfaces:
TaskQueue<Task<? extends java.lang.Object>>
Direct Known Subclasses:
BoundedTaskQueue, UnboundedTaskQueue

public abstract class AbstractBlockingTaskQueue
extends java.lang.Object
implements TaskQueue<Task<? extends java.lang.Object>>
A AbstractBlockingTaskQueue provides a skeletal implementation of the TaskQueue interface. To implement an un/bounded queue of Task, the programmer only needs to extend this class and concretely implement its abstract methods.
Author:
nealk
  • Field Summary

    Fields 
    Modifier and Type Field Description
    protected java.util.Queue<Task<? extends java.lang.Object>> queue  
  • Constructor Summary

    Constructors 
    Constructor Description
    AbstractBlockingTaskQueue()  
  • Method Summary

    Modifier and Type Method Description
    Task<? extends java.lang.Object> dequeue()
    Removes an element from the tail of the queue and returns it.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.jbrew.concurrent.TaskQueue

    enqueue
  • Field Details

    • queue

      protected final java.util.Queue<Task<? extends java.lang.Object>> queue
  • Constructor Details

  • Method Details

    • dequeue

      public final Task<? extends java.lang.Object> dequeue()
      Description copied from interface: TaskQueue
      Removes an element from the tail of the queue and returns it. If the queue is empty, the calling Thread is blocked until a Task is added to the queue and it is no longer empty.
      Specified by:
      dequeue in interface TaskQueue<Task<? extends java.lang.Object>>
      Returns:
      The Task which is being removed from the queue.