Class IgniteRebalanceIteratorImpl
- java.lang.Object
-
- org.apache.ignite.internal.processors.cache.distributed.dht.preloader.IgniteRebalanceIteratorImpl
-
- All Implemented Interfaces:
Serializable,AutoCloseable,Iterable<CacheDataRow>,Iterator<CacheDataRow>,IgniteRebalanceIterator,GridSerializableIterator<CacheDataRow>,GridCloseableIterator<CacheDataRow>,GridIterator<CacheDataRow>,IgniteSpiCloseableIterator<CacheDataRow>
public class IgniteRebalanceIteratorImpl extends Object implements IgniteRebalanceIterator
Default iterator for rebalancing.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description IgniteRebalanceIteratorImpl(NavigableMap<Integer,GridCloseableIterator<CacheDataRow>> fullIterators, IgniteHistoricalIterator historicalIterator)
-
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.booleanhasNext()booleanhasNextX()This method is the same asIterator.hasNext(), but allows for failure with exception.booleanhistorical(int partId)booleanisClosed()Checks if iterator has been closed.booleanisPartitionDone(int partId)booleanisPartitionMissing(int partId)Iterator<CacheDataRow>iterator()CacheDataRownext()CacheDataRownextX()This method is the same asIterator.next(), but allows for failure with exception.CacheDataRowpeek()Return next element without moving iterator cursor to the next one.voidremove()voidremoveX()This method is the same asIterator.remove(), but allows for failure with exception.voidsetPartitionMissing(int partId)Marks partition as missing.-
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, spliterator
-
Methods inherited from interface java.util.Iterator
forEachRemaining
-
-
-
-
Constructor Detail
-
IgniteRebalanceIteratorImpl
public IgniteRebalanceIteratorImpl(NavigableMap<Integer,GridCloseableIterator<CacheDataRow>> fullIterators, IgniteHistoricalIterator historicalIterator) throws IgniteCheckedException
- Parameters:
fullIterators-historicalIterator-- Throws:
IgniteCheckedException
-
-
Method Detail
-
historical
public boolean historical(int partId)
- Specified by:
historicalin interfaceIgniteRebalanceIterator- Returns:
Trueif this iterator is a historical iterator starting from the requested partition counter.
-
isPartitionDone
public boolean isPartitionDone(int partId)
- Specified by:
isPartitionDonein interfaceIgniteRebalanceIterator- Parameters:
partId- Partition ID.- Returns:
Trueif all data for given partition was already returned.
-
isPartitionMissing
public boolean isPartitionMissing(int partId)
- Specified by:
isPartitionMissingin interfaceIgniteRebalanceIterator- Parameters:
partId- Partition ID.- Returns:
Trueif partition was marked as missing.
-
setPartitionMissing
public void setPartitionMissing(int partId)
Marks partition as missing.- Specified by:
setPartitionMissingin interfaceIgniteRebalanceIterator- Parameters:
partId- Partition ID.
-
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<CacheDataRow>- 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()
-
nextX
public CacheDataRow 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<CacheDataRow>- 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()
-
peek
public CacheDataRow peek()
Return next element without moving iterator cursor to the next one.- Specified by:
peekin interfaceIgniteRebalanceIterator- Returns:
- Next element or
Nullif there is no more elements.
-
removeX
public void removeX() throws IgniteCheckedExceptionThis method is the same asIterator.remove(), but allows for failure with exception.- Specified by:
removeXin interfaceGridIterator<CacheDataRow>- 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<CacheDataRow>- Specified by:
closein interfaceIgniteSpiCloseableIterator<CacheDataRow>- Throws:
IgniteCheckedException- In case of error.
-
isClosed
public boolean isClosed()
Checks if iterator has been closed.- Specified by:
isClosedin interfaceGridCloseableIterator<CacheDataRow>- Returns:
Trueif iterator has been closed.
-
iterator
public Iterator<CacheDataRow> iterator()
- Specified by:
iteratorin interfaceIterable<CacheDataRow>
-
hasNext
public boolean hasNext()
- Specified by:
hasNextin interfaceIterator<CacheDataRow>
-
next
public CacheDataRow next()
- Specified by:
nextin interfaceIterator<CacheDataRow>
-
remove
public void remove()
- Specified by:
removein interfaceIterator<CacheDataRow>
-
-