public abstract class GridCloseableIteratorAdapterEx<T> extends GridIteratorAdapter<T> implements GridCloseableIterator<T>
Constructor and Description |
---|
GridCloseableIteratorAdapterEx() |
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the iterator and frees all the resources held by the iterator.
|
boolean |
hasNextX()
This method is the same as
Iterator.hasNext() , but allows for failure
with exception. |
boolean |
isClosed()
Checks if iterator has been closed.
|
T |
nextX()
This method is the same as
Iterator.next() , but allows for failure
with exception. |
protected void |
onClose()
Invoked on iterator close.
|
protected abstract boolean |
onHasNext() |
protected abstract T |
onNext() |
protected void |
onRemove()
Called on remove from iterator.
|
void |
removeX()
This method is the same as
Iterator.remove() , but allows for failure
with exception. |
hasNext, iterator, next, remove
public final T nextX() throws IgniteCheckedException
Iterator.next()
, but allows for failure
with exception. Often iterators are used to iterate through values
that have not or have partially been received from remote nodes,
and need to account for possible network failures, rather than
throwing NoSuchElementException
runtime exception.snextX
in interface GridIterator<T>
True
if iterator contains more elements.IgniteCheckedException
- If no more elements can be returned due
to some failure, like a network error for example.Iterator.next()
protected abstract T onNext() throws IgniteCheckedException
IgniteCheckedException
- If failed.NoSuchElementException
- If no element found.public final boolean hasNextX() throws IgniteCheckedException
Iterator.hasNext()
, but allows for failure
with exception. Often iterators are used to iterate through values
that have not or have partially been received from remote nodes,
and need to account for possible network failures, rather than
just returning false
out of Iterator.hasNext()
method.hasNextX
in interface GridIterator<T>
True
if iterator contains more elements.IgniteCheckedException
- If no more elements can be returned due
to some failure, like a network error for example.Iterator.hasNext()
protected abstract boolean onHasNext() throws IgniteCheckedException
True
if iterator has next element.IgniteCheckedException
- If failed.public final void removeX() throws IgniteCheckedException
Iterator.remove()
, but allows for failure
with exception.removeX
in interface GridIterator<T>
IgniteCheckedException
- If failed.protected void onRemove() throws IgniteCheckedException
IgniteCheckedException
- If failed.public final void close() throws IgniteCheckedException
The method is invoked automatically on objects managed by the
try-with-resources
statement.
close
in interface AutoCloseable
close
in interface GridCloseableIterator<T>
close
in interface IgniteSpiCloseableIterator<T>
IgniteCheckedException
- In case of error.protected void onClose() throws IgniteCheckedException
IgniteCheckedException
- If closing failed.public boolean isClosed()
isClosed
in interface GridCloseableIterator<T>
True
if iterator has been closed.
Follow @ApacheIgnite
Ignite Fabric : ver. 2.0.0 Release Date : April 30 2017