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, removepublic final T nextX() throws GridException
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.GridException - If no more elements can be returned due
to some failure, like a network error for example.Iterator.next()protected abstract T onNext() throws GridException
GridException - If failed.NoSuchElementException - If no element found.public final boolean hasNextX()
throws GridException
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.GridException - If no more elements can be returned due
to some failure, like a network error for example.Iterator.hasNext()protected abstract boolean onHasNext()
throws GridException
True if iterator has next element.GridException - If failed.public final void removeX()
throws GridException
Iterator.remove(), but allows for failure
with exception.removeX in interface GridIterator<T>GridException - If failed.protected void onRemove()
throws GridException
GridException - If failed.public final void close()
throws GridException
The method is invoked automatically on objects managed by the
try-with-resources statement.
close in interface AutoCloseableclose in interface GridSpiCloseableIterator<T>close in interface GridCloseableIterator<T>GridException - In case of error.protected void onClose()
throws GridException
GridException - If closing failed.public boolean isClosed()
isClosed in interface GridCloseableIterator<T>True if iterator has been closed.Copyright © 2014. All rights reserved.