Interface BlockingIterable.Processor<T>

Type Parameters:
T - the type of elements returned by the BlockingIterator.
All Superinterfaces:
AutoCloseable, BlockingIterable<T>, CloseableIterable<T>, Iterable<T>
Enclosing interface:
BlockingIterable<T>

public static interface BlockingIterable.Processor<T> extends BlockingIterable<T>, AutoCloseable
A 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.

Lifetime

There are two aspects of the lifetime of this Processor, one from the producer side and one from the consumer side (BlockingIterator.

Producer Lifetime

A producer MUST invoke either close() (successful termination) or fail(Throwable) (unsuccessful termination) to correctly terminate the producer side of this Processor.

Consumer Lifetime

A consumer can prematurely indicate termination by calling 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().