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

## Class GridDhtPartitionsExchangeFuture

- java.lang.Object
- - org.apache.ignite.internal.util.future.GridFutureAdapter<AffinityTopologyVersion>
  - - org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTopologyFutureAdapter
    - - org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsExchangeFuture

All Implemented Interfaces:
  Comparable<GridDhtPartitionsExchangeFuture>, IgniteDiagnosticAware, IgniteInternalFuture<AffinityTopologyVersion>, CachePartitionExchangeWorkerTask, GridDhtTopologyFuture

    public class GridDhtPartitionsExchangeFuture
    extends GridDhtTopologyFutureAdapter
    implements Comparable<GridDhtPartitionsExchangeFuture>, CachePartitionExchangeWorkerTask, IgniteDiagnosticAware

Future for exchanging partition maps.

### Nested Class Summary

### Nested classes/interfaces inherited from class org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTopologyFutureAdapter

`GridDhtTopologyFutureAdapter.CacheValidation`

### Field Summary

Fields
`static String` `EXCHANGE_LOG`

### Fields inherited from class org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTopologyFutureAdapter

`grpValidRes`

### Constructor Summary

Constructors
Constructor and Description
`GridDhtPartitionsExchangeFuture(GridCacheSharedContext cctx, boolean reassign, DiscoveryEvent discoEvt, GridDhtPartitionExchangeId exchId)` Dummy future created to trigger reassignments if partition topology changed while preloading.
`GridDhtPartitionsExchangeFuture(GridCacheSharedContext cctx, DiscoveryEvent discoEvt, GridDhtPartitionExchangeId exchId, GridCompoundFuture<Boolean,Boolean> forcedRebFut)` Force preload future created to trigger reassignments if partition topology changed while preloading.
`GridDhtPartitionsExchangeFuture(GridCacheSharedContext cctx, ReadWriteLock busyLock, GridDhtPartitionExchangeId exchId, ExchangeActions exchActions, CacheAffinityChangeMessage affChangeMsg)`

### Method Summary

Methods
`boolean` `activateCluster()`
`void` `addDiagnosticRequest(IgniteDiagnosticPrepareContext diagCtx)`
`void` `affinityChangeMessage(CacheAffinityChangeMessage affChangeMsg)`
`boolean` `cacheAddedOnExchange(int cacheId, UUID rcvdFrom)`
`boolean` `cacheGroupAddedOnExchange(int grpId, UUID rcvdFrom)`
`void` `cleanUp()` Cleans up resources to avoid excessive memory usage.
`int` `compareTo(GridDhtPartitionsExchangeFuture fut)`
`DiscoCache` `discoCache()`
`DiscoveryEvent` `discoveryEvent()`
`boolean` `dummy()`
`boolean` `dummyReassign()`
`boolean` `dynamicCacheGroupStarted(int grpId)`
`boolean` `equals(Object o)`
`void` `exchangeActions(ExchangeActions exchActions)`
`GridDhtPartitionExchangeId` `exchangeId()`
`GridCompoundFuture<Boolean,Boolean>` `forcedRebalanceFuture()`
`boolean` `forcePreload()`
`int` `hashCode()`
`void` `init()` Starts activity.
`static long` `nextDumpTimeout(int step, long timeout)`
`boolean` `onAdded()`
`void` `onAffinityChangeMessage(ClusterNode node, CacheAffinityChangeMessage msg)` Affinity change message callback, processed from the same thread as `onNodeLeft(org.apache.ignite.cluster.ClusterNode)`.
`boolean` `onDone(AffinityTopologyVersion res, Throwable err)` Callback to notify that future is finished.
`void` `onEvent(GridDhtPartitionExchangeId exchId, DiscoveryEvent discoEvt, DiscoCache discoCache)` Event callback.
`void` `onNodeLeft(ClusterNode node)` Node left callback, processed from the same thread as `onAffinityChangeMessage(org.apache.ignite.cluster.ClusterNode, org.apache.ignite.internal.processors.cache.CacheAffinityChangeMessage)`.
`void` `onReceive(ClusterNode node, GridDhtPartitionsFullMessage msg)`
`void` `onReceive(ClusterNode node, GridDhtPartitionsSingleMessage msg)`
`UUID` `partitionHistorySupplier(int grpId, int partId)`
`boolean` `reassign()`
`boolean` `reconnectOnError(Throwable e)`
`boolean` `serverNodeDiscoveryEvent()`
`String` `shortInfo()`
`boolean` `skipPreload()`
`AffinityTopologyVersion` `topologyVersion()` Gets topology version of this future.
`String` `toString()`

### Methods inherited from class org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTopologyFutureAdapter

`validateCache, validateCacheGroup`

### Methods inherited from class org.apache.ignite.internal.util.future.GridFutureAdapter

`cancel, chain, chain, error, get, get, get, getUninterruptibly, ignoreInterrupts, isCancelled, isDone, isFailed, listen, logger, onCancelled, onDone, onDone, onDone, onDone, result`

### Methods inherited from class java.lang.Object

`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

### Methods inherited from interface org.apache.ignite.internal.IgniteInternalFuture

`cancel, chain, chain, error, get, get, get, getUninterruptibly, isCancelled, isDone, listen, result`

### Field Detail

#### EXCHANGE_LOG

    public static final String EXCHANGE_LOG

See Also:
  Constant Field Values

### Constructor Detail

#### GridDhtPartitionsExchangeFuture

    public GridDhtPartitionsExchangeFuture(GridCacheSharedContext cctx,
                                   boolean reassign,
                                   DiscoveryEvent discoEvt,
                                   GridDhtPartitionExchangeId exchId)

Dummy future created to trigger reassignments if partition topology changed while preloading.

Parameters:
  `cctx` - Cache context.
  `reassign` - Dummy reassign flag.
  `discoEvt` - Discovery event.
  `exchId` - Exchange id.

#### GridDhtPartitionsExchangeFuture

    public GridDhtPartitionsExchangeFuture(GridCacheSharedContext cctx,
                                   DiscoveryEvent discoEvt,
                                   GridDhtPartitionExchangeId exchId,
                                   GridCompoundFuture<Boolean,Boolean> forcedRebFut)

Force preload future created to trigger reassignments if partition topology changed while preloading.

Parameters:
  `cctx` - Cache context.
  `discoEvt` - Discovery event.
  `exchId` - Exchange id.
  `forcedRebFut` - Forced Rebalance future.

#### GridDhtPartitionsExchangeFuture

    public GridDhtPartitionsExchangeFuture(GridCacheSharedContext cctx,
                                   ReadWriteLock busyLock,
                                   GridDhtPartitionExchangeId exchId,
                                   ExchangeActions exchActions,
                                   CacheAffinityChangeMessage affChangeMsg)

Parameters:
  `cctx` - Cache context.
  `busyLock` - Busy lock.
  `exchId` - Exchange ID.
  `exchActions` - Cache change requests.
  `affChangeMsg` - Affinity change message.

### Method Detail

#### exchangeActions

    public void exchangeActions(ExchangeActions exchActions)

Parameters:
  `exchActions` - Exchange actions.

#### affinityChangeMessage

    public void affinityChangeMessage(CacheAffinityChangeMessage affChangeMsg)

Parameters:
  `affChangeMsg` - Affinity change message.

#### topologyVersion

    public AffinityTopologyVersion topologyVersion()

Gets topology version of this future.

Specified by:
  `topologyVersion` in interface `GridDhtTopologyFuture`
Returns:
  Topology version.

#### skipPreload

    public boolean skipPreload()

Returns:
  Skip preload flag.

#### dummy

    public boolean dummy()

Returns:
  Dummy flag.

#### forcePreload

    public boolean forcePreload()

Returns:
  Force preload flag.

#### reassign

    public boolean reassign()

Returns:
  Dummy reassign flag.

#### dummyReassign

    public boolean dummyReassign()

Returns:
  `True` if dummy reassign.

#### partitionHistorySupplier

    @Nullable
    public UUID partitionHistorySupplier(int grpId,
                                         int partId)

Parameters:
  `grpId` - Cache group ID.
  `partId` - Partition ID.
Returns:
  ID of history supplier node or null if it doesn't exist.

#### discoCache

    public DiscoCache discoCache()

Returns:
  Discovery cache.

#### cacheAddedOnExchange

    public boolean cacheAddedOnExchange(int cacheId,
                               UUID rcvdFrom)

Parameters:
  `cacheId` - Cache ID.
  `rcvdFrom` - Node ID cache was received from.
Returns:
  `True` if cache was added during this exchange.

#### cacheGroupAddedOnExchange

    public boolean cacheGroupAddedOnExchange(int grpId,
                                    UUID rcvdFrom)

Parameters:
  `grpId` - Cache group ID.
  `rcvdFrom` - Node ID cache group was received from.
Returns:
  `True` if cache group was added during this exchange.

#### dynamicCacheGroupStarted

    public boolean dynamicCacheGroupStarted(int grpId)

Parameters:
  `grpId` - Cache group ID.
Returns:
  `True` if non-client cache group was added during this exchange.

#### onAdded

    public boolean onAdded()

Returns:
  `True`

#### onEvent

    public void onEvent(GridDhtPartitionExchangeId exchId,
               DiscoveryEvent discoEvt,
               DiscoCache discoCache)

Event callback.

Parameters:
  `exchId` - Exchange ID.
  `discoEvt` - Discovery event.
  `discoCache` - Discovery data cache.

#### activateCluster

    public boolean activateCluster()

Returns:
  `True` if activate cluster exchange.

#### discoveryEvent

    public DiscoveryEvent discoveryEvent()

Returns:
  Discovery event.

#### exchangeId

    public GridDhtPartitionExchangeId exchangeId()

Returns:
  Exchange ID.

#### forcedRebalanceFuture

    @Nullable
    public GridCompoundFuture<Boolean,Boolean> forcedRebalanceFuture()

Returns:
  Forced Rebalance future.

#### init

    public void init()
              throws IgniteInterruptedCheckedException

Starts activity.

Throws:
  `IgniteInterruptedCheckedException` - If interrupted.

#### serverNodeDiscoveryEvent

    public boolean serverNodeDiscoveryEvent()

Returns:
  `True` if exchange triggered by server node join or fail.

#### onDone

    public boolean onDone(@Nullable
                 AffinityTopologyVersion res,
                 @Nullable
                 Throwable err)

Callback to notify that future is finished. Note that if non-`null` exception is passed in the result value will be ignored.

Overrides:
  `onDone` in class `GridFutureAdapter<AffinityTopologyVersion>`
Parameters:
  `res` - Optional result.
  `err` - Optional error.
Returns:
  `True` if result was set by this call.

#### cleanUp

    public void cleanUp()

Cleans up resources to avoid excessive memory usage.

#### onReceive

    public void onReceive(ClusterNode node,
                 GridDhtPartitionsSingleMessage msg)

Parameters:
  `node` - Sender node.
  `msg` - Single partition info.

#### onReceive

    public void onReceive(ClusterNode node,
                 GridDhtPartitionsFullMessage msg)

Parameters:
  `node` - Sender node.
  `msg` - Full partition info.

#### onAffinityChangeMessage

    public void onAffinityChangeMessage(ClusterNode node,
                               CacheAffinityChangeMessage msg)

Affinity change message callback, processed from the same thread as `onNodeLeft(org.apache.ignite.cluster.ClusterNode)`.

Parameters:
  `node` - Message sender node.
  `msg` - Message.

#### onNodeLeft

    public void onNodeLeft(ClusterNode node)

Node left callback, processed from the same thread as `onAffinityChangeMessage(org.apache.ignite.cluster.ClusterNode, org.apache.ignite.internal.processors.cache.CacheAffinityChangeMessage)`.

Parameters:
  `node` - Left node.

#### reconnectOnError

    public boolean reconnectOnError(Throwable e)

Parameters:
  `e` - Exception.
Returns:
  `True` if local node should try reconnect in case of error.

#### compareTo

    public int compareTo(GridDhtPartitionsExchangeFuture fut)

Specified by:
  `compareTo` in interface `Comparable<GridDhtPartitionsExchangeFuture>`

#### equals

    public boolean equals(Object o)

Overrides:
  `equals` in class `Object`

#### hashCode

    public int hashCode()

Overrides:
  `hashCode` in class `Object`

#### addDiagnosticRequest

    public void addDiagnosticRequest(IgniteDiagnosticPrepareContext diagCtx)

Specified by:
  `addDiagnosticRequest` in interface `IgniteDiagnosticAware`
Parameters:
  `diagCtx` - Context.

#### shortInfo

    public String shortInfo()

Returns:
  Short information string.

#### toString

    public String toString()

Overrides:
  `toString` in class `GridFutureAdapter<AffinityTopologyVersion>`

#### nextDumpTimeout

    public static long nextDumpTimeout(int step,
                       long timeout)

Parameters:
  `step` - Exponent coefficient.
  `timeout` - Base timeout.
Returns:
  Time to wait before next debug dump.

2017 Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Fabric | : ver. 2.2.0
Release Date | : September 15 2017