Class FilteredWalIterator
- java.lang.Object
-
- org.apache.ignite.internal.util.lang.GridIteratorAdapter<IgniteBiTuple<WALPointer,WALRecord>>
-
- org.apache.ignite.internal.processors.cache.persistence.wal.reader.FilteredWalIterator
-
- All Implemented Interfaces:
Serializable,AutoCloseable,Iterable<IgniteBiTuple<WALPointer,WALRecord>>,Iterator<IgniteBiTuple<WALPointer,WALRecord>>,WALIterator,GridSerializableIterator<IgniteBiTuple<WALPointer,WALRecord>>,GridCloseableIterator<IgniteBiTuple<WALPointer,WALRecord>>,GridIterator<IgniteBiTuple<WALPointer,WALRecord>>,IgniteSpiCloseableIterator<IgniteBiTuple<WALPointer,WALRecord>>
public class FilteredWalIterator extends GridIteratorAdapter<IgniteBiTuple<WALPointer,WALRecord>> implements WALIterator
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description FilteredWalIterator(WALIterator walIterator, Predicate<IgniteBiTuple<WALPointer,WALRecord>> filter)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Closes the iterator and frees all the resources held by the iterator.booleanhasNextX()This method is the same asIterator.hasNext(), but allows for failure with exception.booleanisClosed()Checks if iterator has been closed.Optional<WALPointer>lastRead()IgniteBiTuple<WALPointer,WALRecord>nextX()This method is the same asIterator.next(), but allows for failure with exception.voidremoveX()This method is the same asIterator.remove(), but allows for failure with exception.-
Methods inherited from class org.apache.ignite.internal.util.lang.GridIteratorAdapter
hasNext, iterator, next, remove
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, iterator, spliterator
-
Methods inherited from interface java.util.Iterator
forEachRemaining, hasNext, next, remove
-
-
-
-
Constructor Detail
-
FilteredWalIterator
public FilteredWalIterator(WALIterator walIterator, Predicate<IgniteBiTuple<WALPointer,WALRecord>> filter) throws IgniteCheckedException
- Parameters:
walIterator- Source WAL iterator which provide data for filtering.filter- Filter for filtering iterated data.- Throws:
IgniteCheckedException
-
-
Method Detail
-
lastRead
public Optional<WALPointer> lastRead()
- Specified by:
lastReadin interfaceWALIterator- Returns:
- Pointer to the last record returned by the
Iterator.next()method. If records are filtered by theIgniteWalIteratorFactory.IteratorParametersBuilder.filter(IgniteBiPredicate)then pointer to the last valid record returned.
-
nextX
public IgniteBiTuple<WALPointer,WALRecord> nextX() throws IgniteCheckedException
This method is the same asIterator.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 throwingNoSuchElementExceptionruntime exception.s- Specified by:
nextXin interfaceGridIterator<IgniteBiTuple<WALPointer,WALRecord>>- Returns:
Trueif iterator contains more elements.- Throws:
IgniteCheckedException- If no more elements can be returned due to some failure, like a network error for example.- See Also:
Iterator.next()
-
hasNextX
public boolean hasNextX() throws IgniteCheckedExceptionThis method is the same asIterator.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 returningfalseout ofIterator.hasNext()method.- Specified by:
hasNextXin interfaceGridIterator<IgniteBiTuple<WALPointer,WALRecord>>- Returns:
Trueif iterator contains more elements.- Throws:
IgniteCheckedException- If no more elements can be returned due to some failure, like a network error for example.- See Also:
Iterator.hasNext()
-
removeX
public void removeX() throws IgniteCheckedExceptionThis method is the same asIterator.remove(), but allows for failure with exception.- Specified by:
removeXin interfaceGridIterator<IgniteBiTuple<WALPointer,WALRecord>>- Throws:
IgniteCheckedException- If failed.
-
close
public 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 interfaceGridCloseableIterator<IgniteBiTuple<WALPointer,WALRecord>>- Specified by:
closein interfaceIgniteSpiCloseableIterator<IgniteBiTuple<WALPointer,WALRecord>>- Throws:
IgniteCheckedException- In case of error.
-
isClosed
public boolean isClosed()
Checks if iterator has been closed.- Specified by:
isClosedin interfaceGridCloseableIterator<IgniteBiTuple<WALPointer,WALRecord>>- Returns:
Trueif iterator has been closed.
-
-