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

## Class GridDhtPartitionsExchangeFuture

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

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

    public class GridDhtPartitionsExchangeFuture
    extends GridFutureAdapter<AffinityTopologyVersion>
    implements Comparable<GridDhtPartitionsExchangeFuture>, GridDhtTopologyFuture

Future for exchanging partition maps.

See Also:
  Serialized Form

### Nested Class Summary

### Nested classes/interfaces inherited from class java.util.concurrent.locks.AbstractQueuedSynchronizer

`AbstractQueuedSynchronizer.ConditionObject`

### 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)` Force preload future created to trigger reassignments if partition topology changed while preloading.
`GridDhtPartitionsExchangeFuture(GridCacheSharedContext cctx, ReadWriteLock busyLock, GridDhtPartitionExchangeId exchId, Collection<DynamicCacheChangeRequest> reqs)`

### Method Summary

Methods
`void` `cacheChangeRequests(Collection<DynamicCacheChangeRequest> reqs)`
`void` `cleanUp()` Cleans up resources to avoid excessive memory usage.
`int` `compareTo(GridDhtPartitionsExchangeFuture fut)`
`DiscoveryEvent` `discoveryEvent()`
`boolean` `dummy()`
`boolean` `dummyReassign()`
`boolean` `equals(Object o)`
`GridDhtPartitionExchangeId` `exchangeId()`
`boolean` `forcePreload()`
`int` `hashCode()`
`void` `init()` Starts activity.
`boolean` `isCacheAdded(int cacheId, AffinityTopologyVersion topVer)`
`boolean` `isLocalClientAdded(int cacheId)`
`boolean` `onAdded()`
`boolean` `onDone(AffinityTopologyVersion res, Throwable err)` Callback to notify that future is finished.
`void` `onEvent(GridDhtPartitionExchangeId exchId, DiscoveryEvent discoEvt)` Event callback.
`void` `onNodeLeft(UUID nodeId)`
`void` `onReceive(UUID nodeId, GridDhtPartitionsFullMessage msg)`
`void` `onReceive(UUID nodeId, GridDhtPartitionsSingleMessage msg)`
`boolean` `reassign()`
`boolean` `skipPreload()`
`AffinityTopologyVersion` `topologyVersion()` Gets topology version of this future.
`String` `toString()`
`Throwable` `validateCache(GridCacheContext cctx)` Returns error is cache topology is not valid.

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

`cancel, chain, duration, endTime, error, get, get, get, get0, getUninterruptibly, ignoreInterrupts, isCancelled, isDone, isFailed, listen, onCancelled, onDone, onDone, onDone, result, startTime, tryAcquireShared, tryReleaseShared`

### Methods inherited from class java.util.concurrent.locks.AbstractQueuedSynchronizer

`acquire, acquireInterruptibly, acquireShared, acquireSharedInterruptibly, compareAndSetState, getExclusiveQueuedThreads, getFirstQueuedThread, getQueuedThreads, getQueueLength, getSharedQueuedThreads, getState, getWaitingThreads, getWaitQueueLength, hasContended, hasQueuedPredecessors, hasQueuedThreads, hasWaiters, isHeldExclusively, isQueued, owns, release, releaseShared, setState, tryAcquire, tryAcquireNanos, tryAcquireSharedNanos, tryRelease`

### Methods inherited from class java.util.concurrent.locks.AbstractOwnableSynchronizer

`getExclusiveOwnerThread, setExclusiveOwnerThread`

### 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, duration, error, get, get, get, getUninterruptibly, isCancelled, isDone, listen, result, startTime`

### 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)

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

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

#### GridDhtPartitionsExchangeFuture

    public GridDhtPartitionsExchangeFuture(GridCacheSharedContext cctx,
                                   ReadWriteLock busyLock,
                                   GridDhtPartitionExchangeId exchId,
                                   Collection<DynamicCacheChangeRequest> reqs)

Parameters:
  `cctx` - Cache context.
  `busyLock` - Busy lock.
  `exchId` - Exchange ID.
  `reqs` - Cache change requests.

### Method Detail

#### cacheChangeRequests

    public void cacheChangeRequests(Collection<DynamicCacheChangeRequest> reqs)

Parameters:
  `reqs` - Cache change requests.

#### 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.

#### isCacheAdded

    public boolean isCacheAdded(int cacheId,
                       AffinityTopologyVersion topVer)

Parameters:
  `cacheId` - Cache ID to check.
  `topVer` - Topology version.
Returns:
  `True` if cache was added during this exchange.

#### isLocalClientAdded

    public boolean isLocalClientAdded(int cacheId)

Parameters:
  `cacheId` - Cache ID.
Returns:
  `True` if local client has been added.

#### onAdded

    public boolean onAdded()

Returns:
  `True`

#### onEvent

    public void onEvent(GridDhtPartitionExchangeId exchId,
               DiscoveryEvent discoEvt)

Event callback.

Parameters:
  `exchId` - Exchange ID.
  `discoEvt` - Discovery event.

#### discoveryEvent

    public DiscoveryEvent discoveryEvent()

Returns:
  Discovery event.

#### exchangeId

    public GridDhtPartitionExchangeId exchangeId()

Returns:
  Exchange ID.

#### init

    public void init()
              throws IgniteInterruptedCheckedException

Starts activity.

Throws:
  `IgniteInterruptedCheckedException` - If interrupted.

#### onDone

    public boolean onDone(AffinityTopologyVersion res,
                 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.

#### validateCache

    public Throwable validateCache(GridCacheContext cctx)

Returns error is cache topology is not valid.

Specified by:
  `validateCache` in interface `GridDhtTopologyFuture`
Parameters:
  `cctx` - Cache context.
Returns:
  valid ot not.

#### cleanUp

    public void cleanUp()

Cleans up resources to avoid excessive memory usage.

#### onReceive

    public void onReceive(UUID nodeId,
                 GridDhtPartitionsSingleMessage msg)

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

#### onReceive

    public void onReceive(UUID nodeId,
                 GridDhtPartitionsFullMessage msg)

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

#### onNodeLeft

    public void onNodeLeft(UUID nodeId)

Parameters:
  `nodeId` - Left node id.

#### 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`

#### toString

    public String toString()

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

2015 Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Fabric | : ver. 1.5.0.final
Release Date | : December 29 2015