Interface GridCloseableIterator<T>
-
- All Superinterfaces:
AutoCloseable,GridIterator<T>,GridSerializableIterator<T>,IgniteSpiCloseableIterator<T>,Iterable<T>,Iterator<T>,Serializable
- All Known Subinterfaces:
CacheWeakQueryIteratorsHolder.WeakReferenceCloseableIterator<T>,IgniteHistoricalIterator,IgniteRebalanceIterator,WALIterator
- All Known Implementing Classes:
AbstractScanQueryIterator,AbstractWalRecordsIterator,CacheWeakQueryIteratorsHolder.WeakQueryCloseableIterator,FilteredWalIterator,GridCloseableIteratorAdapter,GridCloseableIteratorAdapterEx,GridEmptyCloseableIterator,GridSpiCloseableIteratorWrapper,IgniteRebalanceIteratorImpl,IgniteSingletonIterator,ScanQueryIterator,SingleSegmentLogicalRecordsIterator
public interface GridCloseableIterator<T> extends GridIterator<T>, IgniteSpiCloseableIterator<T>, AutoCloseable
Defines "rich" closeable iterator interface that is also acts like lambda function and iterable.Any instance of this interface should be closed when it's no longer needed.
Here is the common use of closable iterator.
GridCloseableIterator
iter = getIterator(); try { while(iter.hasNext()) { T next = iter.next(); ... ... } } finally { iter.close(); }
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidclose()Closes the iterator and frees all the resources held by the iterator.booleanisClosed()Checks if iterator has been closed.-
Methods inherited from interface org.apache.ignite.internal.util.lang.GridIterator
hasNextX, nextX, removeX
-
Methods inherited from interface java.lang.Iterable
forEach, iterator, spliterator
-
Methods inherited from interface java.util.Iterator
forEachRemaining, hasNext, next, remove
-
-
-
-
Method Detail
-
close
void close() throws IgniteCheckedExceptionCloses the iterator and frees all the resources held by the iterator. Iterator can not be used any more after calling this method.The method is invoked automatically on objects managed by the
try-with-resourcesstatement.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceIgniteSpiCloseableIterator<T>- Throws:
IgniteCheckedException- In case of error.
-
isClosed
boolean isClosed()
Checks if iterator has been closed.- Returns:
Trueif iterator has been closed.
-
-