public static class DataStreams.BlockingQueueIterator<T>
extends java.lang.Object
implements java.lang.AutoCloseable, java.util.Iterator<T>
hasNext()
and next()
will block until a value is
available or this has been closed.
External synchronization must be provided if multiple readers would like to access the
Iterator.hasNext()
and Iterator.next()
methods.
The order or values which are appended to this iterator is nondeterministic when multiple
threads call accept(Object)
.
Constructor and Description |
---|
BlockingQueueIterator(java.util.concurrent.BlockingQueue<T> queue) |
Modifier and Type | Method and Description |
---|---|
void |
accept(T t) |
void |
close() |
boolean |
hasNext() |
T |
next() |
void |
remove() |
public BlockingQueueIterator(java.util.concurrent.BlockingQueue<T> queue)
public void close() throws java.lang.Exception
close
in interface java.lang.AutoCloseable
java.lang.Exception
public void accept(T t) throws java.lang.Exception
java.lang.Exception
public boolean hasNext()
hasNext
in interface java.util.Iterator<T>
public void remove()
remove
in interface java.util.Iterator<T>