com.waveset.util
Class BlockingQueueIterator
java.lang.Object
com.waveset.util.BlockingQueueIterator
- Direct Known Subclasses:
- DoubleBufferQueue
- public class BlockingQueueIterator
- extends java.lang.Object
The BlockingQueueIterator emulates an Iterator, but allows WavesetException
to be thrown by both nextElement() and hasMoreElements().
Field Summary |
static java.lang.String |
code_id
|
static java.lang.Object |
END_OF_DATA
The END_OF_DATA object is passed in to signal that there are no more elements
to be inserted in the queue |
Method Summary |
void |
close()
|
protected EDU.oswego.cs.dl.util.concurrent.BoundedBuffer |
getQueue()
|
boolean |
hasMoreElements()
Indicate if there are more objects in the queue |
java.lang.Object |
nextElement()
Take the next object from the queue. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
code_id
public static final java.lang.String code_id
- See Also:
- Constant Field Values
END_OF_DATA
public static final java.lang.Object END_OF_DATA
- The END_OF_DATA object is passed in to signal that there are no more elements
to be inserted in the queue
BlockingQueueIterator
public BlockingQueueIterator(EDU.oswego.cs.dl.util.concurrent.BoundedBuffer queue)
hasMoreElements
public boolean hasMoreElements()
throws WavesetException
- Indicate if there are more objects in the queue
- Returns:
- true if there are more objects in the queue
- Throws:
WavesetException
close
public void close()
nextElement
public java.lang.Object nextElement()
throws java.util.NoSuchElementException,
WavesetException
- Take the next object from the queue.
If an exception occured in the Supplier, it is dequeued, and rethrown to the
Consumer as a WavesetException.
Note that this can throw NoSuchElementException, even if hasMoreElements()
has returned true to the user, since another thread may have dequeued the object.
- Returns:
- next enqueued object
- Throws:
WavesetException
java.util.NoSuchElementException
getQueue
protected EDU.oswego.cs.dl.util.concurrent.BoundedBuffer getQueue()