net.sf.zig_project.gpl.common.queue
Interface OrderedBlockingQueue

All Superinterfaces:
Queue
All Known Subinterfaces:
GenericBlockingQueue, GenericQueue, OrderedQueue
All Known Implementing Classes:
LinearDispatchQueue, LinearOrderedQueue, PriorityQueue, PriorityQueueBase

public interface OrderedBlockingQueue
extends Queue

Removes elements from a Queue in some ordered fashion. Direct implementations may pause during a remove operation if the Queue is empty, and wait for an element to be added.

Version:
October 12, 2004
Author:
Frank Ziglar
See Also:
OrderedQueue

Method Summary
 Object peekNext()
          Retrieves the next Object from the queue without removing it.
 Object removeNext()
          Removes the next Object from the queue.
 
Methods inherited from interface net.sf.zig_project.gpl.common.queue.Queue
clear, contains, elements, isEmpty, remove
 

Method Detail

removeNext

public Object removeNext()
                  throws InterruptedException
Removes the next Object from the queue. This method may synchronize itself wait for notification that an item has been added to the queue if it was empty. It may also return null if the Queue is empty, and the queue is forced to be "impatient".

Returns:
the next Object in the queue, or null if the queue was empty.
Throws:
InterruptedException - if the current thread is interrupted while waiting for an element to become available

peekNext

public Object peekNext()
Retrieves the next Object from the queue without removing it. This method will always return immediately.

Returns:
the next Object in the queue, or null if the queue was empty