org.apache.ignite.internal.processors.cache.distributed.dht.preloader

## 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 and Description
`IgniteRebalanceIteratorImpl(NavigableMap<Integer,GridCloseableIterator<CacheDataRow>> fullIterators, IgniteHistoricalIterator historicalIterator)`

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `close()` Closes the iterator and frees all the resources held by the iterator.
`boolean` `hasNext()`
`boolean` `hasNextX()` This method is the same as `Iterator.hasNext()`, but allows for failure with exception.
`boolean` `historical(int partId)`
`boolean` `isClosed()` Checks if iterator has been closed.
`boolean` `isPartitionDone(int partId)`
`boolean` `isPartitionMissing(int partId)`
`Iterator<CacheDataRow>` `iterator()`
`CacheDataRow` `next()`
`CacheDataRow` `nextX()` This method is the same as `Iterator.next()`, but allows for failure with exception.
`void` `remove()`
`void` `removeX()` This method is the same as `Iterator.remove()`, but allows for failure with exception.
`void` `setPartitionMissing(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:
  `historical` in interface `IgniteRebalanceIterator`
Returns:
  `True` if this iterator is a historical iterator starting from the requested partition counter.

#### isPartitionDone

    public boolean isPartitionDone(int partId)

Specified by:
  `isPartitionDone` in interface `IgniteRebalanceIterator`
Parameters:
  `partId` - Partition ID.
Returns:
  `True` if all data for given partition was already returned.

#### isPartitionMissing

    public boolean isPartitionMissing(int partId)

Specified by:
  `isPartitionMissing` in interface `IgniteRebalanceIterator`
Parameters:
  `partId` - Partition ID.
Returns:
  `True` if partition was marked as missing.

#### setPartitionMissing

    public void setPartitionMissing(int partId)

Marks partition as missing.

Specified by:
  `setPartitionMissing` in interface `IgniteRebalanceIterator`
Parameters:
  `partId` - Partition ID.

#### hasNextX

    public boolean hasNextX()
                     throws IgniteCheckedException

This method is the same as `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.

Specified by:
  `hasNextX` in interface `GridIterator<CacheDataRow>`
Returns:
  `True` if 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 as `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.s

Specified by:
  `nextX` in interface `GridIterator<CacheDataRow>`
Returns:
  `True` if 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()`

#### removeX

    public void removeX()
                 throws IgniteCheckedException

This method is the same as `Iterator.remove()`, but allows for failure with exception.

Specified by:
  `removeX` in interface `GridIterator<CacheDataRow>`
Throws:
  `IgniteCheckedException` - If failed.

#### close

    public void close()
               throws IgniteCheckedException

Closes 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-resources` statement.

Specified by:
  `close` in interface `AutoCloseable`
Specified by:
  `close` in interface `GridCloseableIterator<CacheDataRow>`
Specified by:
  `close` in interface `IgniteSpiCloseableIterator<CacheDataRow>`
Throws:
  `IgniteCheckedException` - In case of error.

#### isClosed

    public boolean isClosed()

Checks if iterator has been closed.

Specified by:
  `isClosed` in interface `GridCloseableIterator<CacheDataRow>`
Returns:
  `True` if iterator has been closed.

#### iterator

    public Iterator<CacheDataRow> iterator()

Specified by:
  `iterator` in interface `Iterable<CacheDataRow>`

#### hasNext

    public boolean hasNext()

Specified by:
  `hasNext` in interface `Iterator<CacheDataRow>`

#### next

    public CacheDataRow next()

Specified by:
  `next` in interface `Iterator<CacheDataRow>`

#### remove

    public void remove()

Specified by:
  `remove` in interface `Iterator<CacheDataRow>`

2018 Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Database and Caching Platform | : ver. 2.7.0
Release Date | : November 30 2018