public interface IAsynchronousIterator<E> extends ICloseableIterator<E>
IBlockingBufferwhich is drained by the
|Modifier and Type||Method and Description|
Notes that the iterator is closed and hence may no longer be read.
Waits up to the timeout to return the next element.
trueiff this iterator will not visit any more elements (non-blocking).
trueiff the iterator is known to be exhausted without blocking. A
falsereturn does NOT imply that the iterator will visit more elements, only that it MIGHT visit more elements.
boolean hasNext(long timeout, TimeUnit unit) throws InterruptedException
trueiff there is at least one element that can be visited. If the buffer is empty then this will block until: (a) an element appears in the buffer; (b) the buffer is
BlockingBuffer.close()ed; or (c) the timeout expires.
Note that a
false return DOES NOT signify that the iterator
is exhausted. However, if you specify an infinite timeout using
TimeUnit.SECONDS then you MAY safely
false return as an indication that the iterator
timeout- The length of time that the method may block awaiting an element to appear.
unit- The units in which the timeout is expressed.
trueiff there is an element available.
InterruptedException- if the current thread is interrupted while waiting another element.
E next(long timeout, TimeUnit unit) throws InterruptedException
timeout- The timeout (overrides the chunkTimeout specified to the
unit- The unit in which the timeout is expressed.
nulliff the timeout was exceeded before
InterruptedException- if the current thread is interrupted while waiting for another element.
IBlockingBufferfrom filling up and deadlocking. For this reason,
close()has consequences NOT entailed by
Note: Depending on the semantics of the producer, it MAY choose to treat
an interrupt() as normal (but eager) termination. For example, rule
execution treats an interrupt() as normal (but eager) termination with
the consequence that queries may be safely interrupted once some limit
has been satisfied. However, the preferred way to treat LIMIT is using
IRule with an
IQueryOptions that specifies a LIMIT.
Copyright © 2006-2012 SYSTAP, LLC. All Rights Reserved.