public class ThickAsynchronousIterator<E> extends Object implements IAsynchronousIterator<E>, Serializable
IAsynchronousIterator
that may be serialized and sent to a remote
JVM for consumption. Since all data to be visited is supplied to the ctor,
the client will be able consume the data without waiting.Constructor and Description |
---|
ThickAsynchronousIterator(E[] a)
Create a thick iterator.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Notes that the iterator is closed and hence may no longer be read.
|
boolean |
hasNext() |
boolean |
hasNext(long timeout,
TimeUnit unit)
Delegates to
hasNext() since all data are local and timeouts can
not occur. |
boolean |
isExhausted()
Return
true iff this iterator will not visit any more
elements (non-blocking). |
E |
next() |
E |
next(long timeout,
TimeUnit unit)
Delegates to
next() since all data are local and timeouts can
not occur. |
void |
remove() |
public ThickAsynchronousIterator(E[] a)
a
- The array of elements to be visited by the iterator (may be
empty, but may not be null
).IllegalArgumentException
- if a is null
.public void close()
IAsynchronousIterator
IBlockingBuffer
from
filling up and deadlocking. For this reason, IAsynchronousIterator.close()
has
consequences NOT entailed by ICloseableIterator
.
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.
close
in interface IAsynchronousIterator<E>
close
in interface ICloseable
close
in interface ICloseableIterator<E>
public boolean isExhausted()
IAsynchronousIterator
true
iff this iterator will not visit any more
elements (non-blocking).isExhausted
in interface IAsynchronousIterator<E>
true
iff the iterator is known to be exhausted
without blocking. A false
return does NOT imply
that the iterator will visit more elements, only that it MIGHT
visit more elements.public boolean hasNext(long timeout, TimeUnit unit)
hasNext()
since all data are local and timeouts can
not occur.hasNext
in interface IAsynchronousIterator<E>
timeout
- The length of time that the method may block awaiting an
element to appear.unit
- The units in which the timeout is expressed.true
iff there is an element available.public E next(long timeout, TimeUnit unit)
next()
since all data are local and timeouts can
not occur.next
in interface IAsynchronousIterator<E>
timeout
- The timeout (overrides the chunkTimeout specified to
the BlockingBuffer
ctor).unit
- The unit in which the timeout is expressed.null
iff the timeout was exceeded
before IAsynchronousIterator.hasNext(long, TimeUnit)
returned
true
.
In order to have a definitive indication that the iterator is
exhausted you need to invoke Iterator.hasNext()
without a timeout
(blocking) or IAsynchronousIterator.isExhausted()
(non-blocking).
Copyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.