org.apache.ignite.internal.processors.cache

## Class GridCachePartitionExchangeManager<K,V>

- java.lang.Object
- - org.apache.ignite.internal.processors.cache.GridCacheSharedManagerAdapter<K,V>
  - - org.apache.ignite.internal.processors.cache.GridCachePartitionExchangeManager<K,V>

All Implemented Interfaces:
  GridCacheSharedManager<K,V>

    public class GridCachePartitionExchangeManager<K,V>
    extends GridCacheSharedManagerAdapter<K,V>

Partition exchange manager.

### Field Summary

### Fields inherited from class org.apache.ignite.internal.processors.cache.GridCacheSharedManagerAdapter

`cctx, diagnosticLog, log`

### Constructor Summary

Constructors
Constructor and Description
`GridCachePartitionExchangeManager()`

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`IgniteInternalFuture<?>` `affinityReadyFuture(AffinityTopologyVersion ver)`
`GridClientPartitionTopology` `clearClientTopology(int grpId)`
`Collection<GridClientPartitionTopology>` `clientTopologies()`
`GridDhtPartitionTopology` `clientTopology(int grpId, DiscoCache discoCache)`
`GridDhtPartitionTopology` `clientTopologyIfExists(int grpId)`
`GridDhtPartitionsFullMessage` `createPartitionsFullMessage(boolean compress, boolean newCntrMap, GridDhtPartitionExchangeId exchId, GridCacheVersion lastVer, IgniteDhtPartitionHistorySuppliersMap partHistSuppliers, IgniteDhtPartitionsToReloadMap partsToReload)`
`GridDhtPartitionsSingleMessage` `createPartitionsSingleMessage(GridDhtPartitionExchangeId exchangeId, boolean clientOnlyExchange, boolean sndCounters, boolean newCntrMap, ExchangeActions exchActions)`
`IgniteInternalFuture<Void>` `deferStopCachesOnClientReconnect(Collection<GridCacheAdapter> caches)`
`void` `dumpDebugInfo(GridDhtPartitionsExchangeFuture exchFut)`
`void` `dumpLongRunningOperations(long timeout)`
`List<GridDhtPartitionsExchangeFuture>` `exchangeFutures()`
`static int` `exchangeProtocolVersion(IgniteProductVersion ver)`
`void` `forceReassign(GridDhtPartitionExchangeId exchId)`
`IgniteInternalFuture<Boolean>` `forceRebalance(GridDhtPartitionExchangeId exchId)`
`boolean` `hasPendingExchange()`
`Object` `interruptLock()`
`GridDhtTopologyFuture` `lastFinishedFuture()`
`void` `lastFinishedFuture(GridDhtTopologyFuture fut)`
`GridDhtPartitionsExchangeFuture` `lastTopologyFuture()`
`ExchangeLatchManager` `latch()`
`boolean` `mergeExchanges(GridDhtPartitionsExchangeFuture curFut, GridDhtPartitionsFullMessage msg)`
`boolean` `mergeExchangesOnCoordinator(GridDhtPartitionsExchangeFuture curFut)`
`void` `mergeExchangesTestWaitVersion(AffinityTopologyVersion exchMergeTestWaitVer)` For testing only.
`void` `onCoordinatorInitialized()`
`void` `onExchangeDone(AffinityTopologyVersion topVer, AffinityTopologyVersion initTopVer, Throwable err)`
`void` `onKernalStart(boolean active, boolean reconnect)`
`protected void` `onKernalStop0(boolean cancel)`
`void` `onLocalJoin(DiscoveryEvent evt, DiscoCache cache)` Callback for local join event (needed since regular event for local join is not generated).
`AffinityTopologyVersion` `readyAffinityVersion()`
`static Object` `rebalanceTopic(int idx)`
`IgniteInternalFuture<?>` `reconnectExchangeFuture()`
`void` `refreshPartitions()` Partition refresh callback.
`void` `scheduleResendPartitions()` Schedules next full partitions update.
`protected void` `start0()`
`protected void` `stop0(boolean cancel)`

### Methods inherited from class org.apache.ignite.internal.processors.cache.GridCacheSharedManagerAdapter

`context, isStopping, kernalStartInfo, kernalStopInfo, log, onDisconnected, onKernalStop, onReconnected, printMemoryStats, start, startInfo, stop, stopInfo, toString`

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

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

### Constructor Detail

#### GridCachePartitionExchangeManager

    public GridCachePartitionExchangeManager()

### Method Detail

#### start0

    protected void start0()
                   throws IgniteCheckedException

Overrides:
  `start0` in class `GridCacheSharedManagerAdapter<K,V>`
Throws:
  `IgniteCheckedException` - If failed.

#### onCoordinatorInitialized

    public void onCoordinatorInitialized()

#### onLocalJoin

    public void onLocalJoin(DiscoveryEvent evt,
                            DiscoCache cache)

Callback for local join event (needed since regular event for local join is not generated).

Parameters:
  `evt` - Event.
  `cache` - Cache.

#### reconnectExchangeFuture

    public IgniteInternalFuture<?> reconnectExchangeFuture()

Returns:
  Reconnect partition exchange future.

#### onKernalStart

    public void onKernalStart(boolean active,
                              boolean reconnect)
                       throws IgniteCheckedException

Parameters:
  `active` - Cluster state.
  `reconnect` - Reconnect flag.
Throws:
  `IgniteCheckedException` - If failed.

#### exchangeProtocolVersion

    public static int exchangeProtocolVersion(IgniteProductVersion ver)

Parameters:
  `ver` - Node version.
Returns:
  Supported exchange protocol version.

#### rebalanceTopic

    public static Object rebalanceTopic(int idx)

Parameters:
  `idx` - Index.
Returns:
  Topic for index.

#### onKernalStop0

    protected void onKernalStop0(boolean cancel)

Overrides:
  `onKernalStop0` in class `GridCacheSharedManagerAdapter<K,V>`
Parameters:
  `cancel` - Cancel flag.

#### stop0

    protected void stop0(boolean cancel)

Overrides:
  `stop0` in class `GridCacheSharedManagerAdapter<K,V>`
Parameters:
  `cancel` - Cancel flag.

#### interruptLock

    public Object interruptLock()

Returns:
  Interrupt lock.

#### clientTopologyIfExists

    @Nullable
    public GridDhtPartitionTopology clientTopologyIfExists(int grpId)

Parameters:
  `grpId` - Cache group ID.
Returns:
  Topology.

#### clientTopology

    public GridDhtPartitionTopology clientTopology(int grpId,
                                                   DiscoCache discoCache)

Parameters:
  `grpId` - Cache group ID.
  `discoCache` - Discovery data cache.
Returns:
  Topology.

#### clientTopologies

    public Collection<GridClientPartitionTopology> clientTopologies()

Returns:
  Collection of client topologies.

#### clearClientTopology

    public GridClientPartitionTopology clearClientTopology(int grpId)

Parameters:
  `grpId` - Cache group ID.
Returns:
  Client partition topology.

#### readyAffinityVersion

    public AffinityTopologyVersion readyAffinityVersion()

Returns:
  Topology version of latest completed partition exchange.

#### lastTopologyFuture

    public GridDhtPartitionsExchangeFuture lastTopologyFuture()

Returns:
  Last initialized topology future.

#### lastFinishedFuture

    @Nullable
    public GridDhtTopologyFuture lastFinishedFuture()

Returns:
  Last finished topology future.

#### lastFinishedFuture

    public void lastFinishedFuture(GridDhtTopologyFuture fut)

Parameters:
  `fut` - Finished future.

#### affinityReadyFuture

    @Nullable
    public IgniteInternalFuture<?> affinityReadyFuture(AffinityTopologyVersion ver)

Parameters:
  `ver` - Topology version.
Returns:
  Future or `null` is future is already completed.

#### exchangeFutures

    public List<GridDhtPartitionsExchangeFuture> exchangeFutures()

Returns:
  Exchange futures.

#### hasPendingExchange

    public boolean hasPendingExchange()

Returns:
  `True` if pending future queue contains exchange task.

#### forceReassign

    public void forceReassign(GridDhtPartitionExchangeId exchId)

Parameters:
  `exchId` - Exchange ID.

#### forceRebalance

    public IgniteInternalFuture<Boolean> forceRebalance(GridDhtPartitionExchangeId exchId)

Parameters:
  `exchId` - Exchange ID.
Returns:
  Rebalance future.

#### deferStopCachesOnClientReconnect

    public IgniteInternalFuture<Void> deferStopCachesOnClientReconnect(Collection<GridCacheAdapter> caches)

Parameters:
  `caches` - Caches to stop.
Returns:
  Future that will be completed when caches are stopped from the exchange thread.

#### scheduleResendPartitions

    public void scheduleResendPartitions()

Schedules next full partitions update.

#### refreshPartitions

    public void refreshPartitions()

Partition refresh callback. For coordinator causes `FullMessages` send, for non coordinator - `SingleMessages` send

#### createPartitionsFullMessage

    public GridDhtPartitionsFullMessage createPartitionsFullMessage(boolean compress,
                                                                    boolean newCntrMap,
                                                                    @Nullable
                                                                    GridDhtPartitionExchangeId exchId,
                                                                    @Nullable
                                                                    GridCacheVersion lastVer,
                                                                    @Nullable
                                                                    IgniteDhtPartitionHistorySuppliersMap partHistSuppliers,
                                                                    @Nullable
                                                                    IgniteDhtPartitionsToReloadMap partsToReload)

Parameters:
  `compress` - `True` if possible to compress message (properly work only if prepareMarshall/ finishUnmarshall methods are called).
  `newCntrMap` - `True` if possible to use `CachePartitionFullCountersMap`.
  `exchId` - Non-null exchange ID if message is created for exchange.
  `lastVer` - Last version.
  `partHistSuppliers` - Partition history suppliers map.
  `partsToReload` - Partitions to reload map.
Returns:
  Message.

#### createPartitionsSingleMessage

    public GridDhtPartitionsSingleMessage createPartitionsSingleMessage(@Nullable
                                                                        GridDhtPartitionExchangeId exchangeId,
                                                                        boolean clientOnlyExchange,
                                                                        boolean sndCounters,
                                                                        boolean newCntrMap,
                                                                        ExchangeActions exchActions)

Parameters:
  `exchangeId` - Exchange ID.
  `clientOnlyExchange` - Client exchange flag.
  `sndCounters` - `True` if need send partition update counters.
  `newCntrMap` - `True` if possible to use `CachePartitionPartialCountersMap`.
Returns:
  Message.

#### onExchangeDone

    public void onExchangeDone(AffinityTopologyVersion topVer,
                               AffinityTopologyVersion initTopVer,
                               @Nullable
                               Throwable err)

Parameters:
  `topVer` - Exchange result topology version.
  `initTopVer` - Exchange initial version.
  `err` - Error.

#### latch

    public ExchangeLatchManager latch()

Returns:
  Latch manager instance.

#### dumpDebugInfo

    public void dumpDebugInfo(@Nullable
                              GridDhtPartitionsExchangeFuture exchFut)
                       throws Exception

Parameters:
  `exchFut` - Optional current exchange future.
Throws:
  `Exception` - If failed.

#### dumpLongRunningOperations

    public void dumpLongRunningOperations(long timeout)

Parameters:
  `timeout` - Operation timeout.

#### mergeExchangesTestWaitVersion

    public void mergeExchangesTestWaitVersion(AffinityTopologyVersion exchMergeTestWaitVer)

For testing only.

Parameters:
  `exchMergeTestWaitVer` - Version to wait for.

#### mergeExchanges

    public boolean mergeExchanges(GridDhtPartitionsExchangeFuture curFut,
                                  GridDhtPartitionsFullMessage msg)
                           throws IgniteInterruptedCheckedException

Parameters:
  `curFut` - Current exchange future.
  `msg` - Message.
Returns:
  `True` if node is stopping.
Throws:
  `IgniteInterruptedCheckedException` - If interrupted.

#### mergeExchangesOnCoordinator

    public boolean mergeExchangesOnCoordinator(GridDhtPartitionsExchangeFuture curFut)

Parameters:
  `curFut` - Current active exchange future.
Returns:
  `False` if need wait messages for merged exchanges.

2018 Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Fabric | : ver. 2.5.0
Release Date | : May 23 2018