T - the type of elements returned by the BlockingIterator.public static interface BlockingIterable.Processor<T> extends BlockingIterable<T>, java.lang.AutoCloseable
BlockingIterable that supports to dynamically emitting items using next(Object).
If multiple BlockingIterators are created by this BlockingIterable then an implementation
will choose how to distribute the items emitted from next(Object) to those BlockingIterators.
There is no common guarantee about the nature of that distribution.
Processor, one from the producer side and one from the
consumer side (BlockingIterator.
close() (successful termination) or
fail(Throwable) (unsuccessful termination) to correctly terminate the producer side of this
Processor.
BlockingIterator.close(). However, if a
consumer receives a termination from the producer end (BlockingIterator.hasNext(long, TimeUnit) returns
false), then it need not call BlockingIterator.close().BlockingIterable.Processor<T>| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes this
BlockingIterable and all the current or future BlockingIterators. |
void |
fail(java.lang.Throwable cause)
Terminates this
BlockingIterable and all the current or future BlockingIterators with a
failure. |
void |
next(T nextItem)
Emits the passed
nextItem from the BlockingIterator when called. |
forEach, forEach, iterator, spliteratorvoid next(@Nullable
T nextItem)
throws java.lang.Exception
nextItem from the BlockingIterator when called.nextItem - to emit from the BlockingIterator when called.java.lang.Exception - If the item could not be emitted.void fail(java.lang.Throwable cause) throws java.lang.Exception
BlockingIterable and all the current or future BlockingIterators with a
failure.
After this method returns, any subsequent calls to next(Object) MUST throw an
Exception. All current and future BlockingIterators created by this BlockingIterable
MUST eventually throw an Exception which is the same as passed cause or
wraps the same.
cause - for the failure.java.lang.Exception - If this BlockingIterable can not be terminated with a failure.void close()
throws java.lang.Exception
BlockingIterable and all the current or future BlockingIterators.
After this method returns, any subsequent calls to next(Object) MUST throw an
Exception. All current and future BlockingIterators created by this BlockingIterable
MUST eventually return false from the various hasNext methods.
close in interface java.lang.AutoCloseablejava.lang.Exception - If closure failed.