|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.flat502.rox.utils.PipelinedBlockingQueue
public class PipelinedBlockingQueue
This class provides a pipelined implementation of the core functionality
of Java 1.5's BlockingQueue
interface.
Elements are enqueued along with the "origin". Pipelining happens
within the context of each origin. Simply put, a thread calling
take()
will never dequeue an item that shares an origin
with another item that was dequeued by a second thread that has not
returned to the queue.
Constructor Summary | |
---|---|
PipelinedBlockingQueue()
|
Method Summary | |
---|---|
void |
add(java.lang.Object element,
java.lang.Object origin)
Adds the specified element to this queue |
java.lang.Object |
take()
Retrieves and removes the free element on this queue. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public PipelinedBlockingQueue()
Method Detail |
---|
public void add(java.lang.Object element, java.lang.Object origin)
element
- The element to enqueueorigin
- The origin associated with this element.
java.lang.NullPointerException
- if the specified element is null
public java.lang.Object take() throws java.lang.InterruptedException
An element is considered free if the origin it is associated with is not shared by another element that was previously dequeued by a thread that has not yet "returned" to this queue
java.lang.InterruptedException
- if interrupted while waiting.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |