Interface TaskQueue<T extends Task<? extends java.lang.Object>>

Type Parameters:
T - - The type of Task. The full type parameter in the interface's signature is:
   <T extends Task<? extends Object>>.
All Known Implementing Classes:
AbstractBlockingTaskQueue, BoundedTaskQueue, UnboundedTaskQueue

public interface TaskQueue<T extends Task<? extends java.lang.Object>>
A TaskQueue is a set of ordered or unordered Tasks placed into a custom queue which can be operated by producers or consumers in one or more Thread.
Author:
nealk
  • Method Summary

    Modifier and Type Method Description
    T dequeue()
    Removes an element from the tail of the queue and returns it.
    void enqueue​(T task)
    Adds an element to the head of the queue.
  • Method Details

    • enqueue

      void enqueue​(T task) throws java.lang.InterruptedException
      Adds an element to the head of the queue. When the queue is full (bounded implementations only), the calling Thread is blocked until capacity in the queue has been released.
      Parameters:
      task - - The Task which is being added to the queue.
      Throws:
      java.lang.InterruptedException - - The method hands off the responsibility of exception handling to the caller in event of an interruption in the Thread.
    • dequeue

      T dequeue() throws java.lang.InterruptedException
      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.
      Returns:
      The Task which is being removed from the queue.
      Throws:
      java.lang.InterruptedException - - The method hands off the responsibility of exception handling to the caller in event of an interruption in the Thread.