public interface GridCloseableIterator<T> extends GridIterator<T>, IgniteSpiCloseableIterator<T>, AutoCloseable
Any instance of this interface should be closed when it's no longer needed.
Here is the common use of closable iterator.
GridCloseableIteratoriter = getIterator(); try { while(iter.hasNext()) { T next = iter.next(); ... ... } } finally { iter.close(); }
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the iterator and frees all the resources held by the iterator.
|
boolean |
isClosed()
Checks if iterator has been closed.
|
hasNextX, nextX, removeX
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 IgniteSpiCloseableIterator<T>
IgniteCheckedException
- In case of error.boolean isClosed()
True
if iterator has been closed.
Follow @ApacheIgnite
Ignite Fabric : ver. 2.0.0 Release Date : April 30 2017