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

## Class GridDhtPreloader

- java.lang.Object
- - org.apache.ignite.internal.processors.cache.GridCachePreloaderAdapter
  - - org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPreloader

All Implemented Interfaces:
  GridCachePreloader

    public class GridDhtPreloader
    extends GridCachePreloaderAdapter

DHT cache preloader.

### Field Summary

Fields
`static long` `DFLT_PRELOAD_RESEND_TIMEOUT` Default preload resend timeout.

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

`ctx, grp, log, preloadPred`

### Constructor Summary

Constructors
Constructor and Description
`GridDhtPreloader(CacheGroupContext grp)`

### Method Summary

All Methods Instance Methods Concrete Methods
`Runnable` `addAssignments(GridDhtPreloaderAssignments assignments, boolean forceRebalance, int cnt, Runnable next, GridCompoundFuture<Boolean,Boolean> forcedRebFut)` Adds assignments to preloader.
`GridDhtPreloaderAssignments` `assign(GridDhtPartitionExchangeId exchId, GridDhtPartitionsExchangeFuture exchFut)`
`void` `dumpDebugInfo()` Dumps debug information.
`void` `evictPartitionAsync(GridDhtLocalPartition part)` Evicts partition asynchronously.
`IgniteInternalFuture<Boolean>` `forceRebalance()` Force Rebalance process.
`void` `handleDemandMessage(int idx, UUID id, GridDhtPartitionDemandMessage d)` Handles Demand message.
`void` `handleSupplyMessage(int idx, UUID id, GridDhtPartitionSupplyMessage s)` Handles Supply message.
`boolean` `needForceKeys()`
`void` `onInitialExchangeComplete(Throwable err)` Callback by exchange manager when initial partition exchange is complete.
`void` `onKernalStop()` Kernal stop callback.
`void` `onPartitionEvicted(GridDhtLocalPartition part, boolean updateSeq)` Resends partitions on partition evict within configured timeout.
`void` `onReconnected()` Client reconnected callback.
`void` `onTopologyChanged(GridDhtPartitionsExchangeFuture lastFut)`
`void` `preloadPredicate(IgnitePredicate<GridCacheEntryInfo> preloadPred)`
`IgniteInternalFuture<Boolean>` `rebalanceFuture()`
`GridDhtFuture<Object>` `request(GridCacheContext cctx, Collection<KeyCacheObject> keys, AffinityTopologyVersion topVer)` Requests that preloader sends the request for the key.
`GridDhtFuture<Object>` `request(GridCacheContext cctx, GridNearAtomicAbstractUpdateRequest req, AffinityTopologyVersion topVer)` Requests that preloader sends the request for the key.
`void` `start()` Starts preloading.
`IgniteInternalFuture<Object>` `startFuture()`
`IgniteInternalFuture<?>` `syncFuture()`
`void` `unwindUndeploys()` Unwinds undeploys.

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

`preloadPredicate`

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

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

### Field Detail

#### DFLT_PRELOAD_RESEND_TIMEOUT

    public static final long DFLT_PRELOAD_RESEND_TIMEOUT

Default preload resend timeout.

See Also:
  Constant Field Values

### Constructor Detail

#### GridDhtPreloader

    public GridDhtPreloader(CacheGroupContext grp)

Parameters:
  `grp` - Cache group.

### Method Detail

#### start

    public void start()

Starts preloading.

Specified by:
  `start` in interface `GridCachePreloader`
Overrides:
  `start` in class `GridCachePreloaderAdapter`

#### preloadPredicate

    public void preloadPredicate(IgnitePredicate<GridCacheEntryInfo> preloadPred)

Specified by:
  `preloadPredicate` in interface `GridCachePreloader`
Overrides:
  `preloadPredicate` in class `GridCachePreloaderAdapter`
Parameters:
  `preloadPred` - Preload predicate.

#### onKernalStop

    public void onKernalStop()

Kernal stop callback.

Specified by:
  `onKernalStop` in interface `GridCachePreloader`
Overrides:
  `onKernalStop` in class `GridCachePreloaderAdapter`

#### onInitialExchangeComplete

    public void onInitialExchangeComplete(@Nullable
                                          Throwable err)

Callback by exchange manager when initial partition exchange is complete.

Specified by:
  `onInitialExchangeComplete` in interface `GridCachePreloader`
Overrides:
  `onInitialExchangeComplete` in class `GridCachePreloaderAdapter`
Parameters:
  `err` - Error, if any happened on initial exchange.

#### onTopologyChanged

    public void onTopologyChanged(GridDhtPartitionsExchangeFuture lastFut)

Specified by:
  `onTopologyChanged` in interface `GridCachePreloader`
Overrides:
  `onTopologyChanged` in class `GridCachePreloaderAdapter`
Parameters:
  `lastFut` - Last future.

#### assign

    public GridDhtPreloaderAssignments assign(GridDhtPartitionExchangeId exchId,
                                              GridDhtPartitionsExchangeFuture exchFut)

Specified by:
  `assign` in interface `GridCachePreloader`
Overrides:
  `assign` in class `GridCachePreloaderAdapter`
Parameters:
  `exchId` - Exchange ID.
  `exchFut` - Exchange future.
Returns:
  Assignments or `null` if detected that there are pending exchanges.

#### onReconnected

    public void onReconnected()

Client reconnected callback.

Specified by:
  `onReconnected` in interface `GridCachePreloader`
Overrides:
  `onReconnected` in class `GridCachePreloaderAdapter`

#### handleSupplyMessage

    public void handleSupplyMessage(int idx,
                                    UUID id,
                                    GridDhtPartitionSupplyMessage s)

Handles Supply message.

Specified by:
  `handleSupplyMessage` in interface `GridCachePreloader`
Overrides:
  `handleSupplyMessage` in class `GridCachePreloaderAdapter`
Parameters:
  `idx` - Index.
  `id` - Node Id.
  `s` - Supply message.

#### handleDemandMessage

    public void handleDemandMessage(int idx,
                                    UUID id,
                                    GridDhtPartitionDemandMessage d)

Handles Demand message.

Specified by:
  `handleDemandMessage` in interface `GridCachePreloader`
Overrides:
  `handleDemandMessage` in class `GridCachePreloaderAdapter`
Parameters:
  `idx` - Index.
  `id` - Node Id.
  `d` - Demand message.

#### addAssignments

    public Runnable addAssignments(GridDhtPreloaderAssignments assignments,
                                   boolean forceRebalance,
                                   int cnt,
                                   Runnable next,
                                   @Nullable
                                   GridCompoundFuture<Boolean,Boolean> forcedRebFut)

Adds assignments to preloader.

Specified by:
  `addAssignments` in interface `GridCachePreloader`
Overrides:
  `addAssignments` in class `GridCachePreloaderAdapter`
Parameters:
  `assignments` - Assignments to add.
  `forceRebalance` - Force preload flag.
  `cnt` - Counter.
  `next` - Runnable responsible for cache rebalancing start.
  `forcedRebFut` - Rebalance future.
Returns:
  Rebalancing runnable.

#### startFuture

    public IgniteInternalFuture<Object> startFuture()

Description copied from class: `GridCachePreloaderAdapter`

Specified by:
  `startFuture` in interface `GridCachePreloader`
Overrides:
  `startFuture` in class `GridCachePreloaderAdapter`
Returns:
  Start future.

#### syncFuture

    public IgniteInternalFuture<?> syncFuture()

Specified by:
  `syncFuture` in interface `GridCachePreloader`
Overrides:
  `syncFuture` in class `GridCachePreloaderAdapter`
Returns:
  Future which will complete when preloading is finished.

#### rebalanceFuture

    public IgniteInternalFuture<Boolean> rebalanceFuture()

Specified by:
  `rebalanceFuture` in interface `GridCachePreloader`
Overrides:
  `rebalanceFuture` in class `GridCachePreloaderAdapter`
Returns:
  Future which will complete when preloading finishes on current topology. Future result is `true` in case rebalancing successfully finished at current topology. Future result is `false` in case rebalancing cancelled or finished with missed partitions and will be restarted at current or pending topology. Note that topology change creates new futures and finishes previous.

#### onPartitionEvicted

    public void onPartitionEvicted(GridDhtLocalPartition part,
                                   boolean updateSeq)

Resends partitions on partition evict within configured timeout.

Parameters:
  `part` - Evicted partition.
  `updateSeq` - Update sequence.

#### needForceKeys

    public boolean needForceKeys()

Specified by:
  `needForceKeys` in interface `GridCachePreloader`
Overrides:
  `needForceKeys` in class `GridCachePreloaderAdapter`
Returns:
  `true` if there is no need to force keys preloading (e.g. rebalancing has been completed).

#### request

    public GridDhtFuture<Object> request(GridCacheContext cctx,
                                         GridNearAtomicAbstractUpdateRequest req,
                                         AffinityTopologyVersion topVer)

Requests that preloader sends the request for the key.

Specified by:
  `request` in interface `GridCachePreloader`
Overrides:
  `request` in class `GridCachePreloaderAdapter`
Parameters:
  `cctx` - Cache context.
  `req` - Message with keys to request.
  `topVer` - Topology version, `-1` if not required.
Returns:
  Future to complete when all keys are preloaded.

#### request

    public GridDhtFuture<Object> request(GridCacheContext cctx,
                                         Collection<KeyCacheObject> keys,
                                         AffinityTopologyVersion topVer)

Description copied from class: `GridCachePreloaderAdapter`
Requests that preloader sends the request for the key.

Specified by:
  `request` in interface `GridCachePreloader`
Overrides:
  `request` in class `GridCachePreloaderAdapter`
Parameters:
  `keys` - Keys to request.
  `cctx` - Cache context.
  `topVer` - Topology version, `-1` if not required.
Returns:
  Future for request.

#### forceRebalance

    public IgniteInternalFuture<Boolean> forceRebalance()

Force Rebalance process.

Specified by:
  `forceRebalance` in interface `GridCachePreloader`
Overrides:
  `forceRebalance` in class `GridCachePreloaderAdapter`

#### unwindUndeploys

    public void unwindUndeploys()

Unwinds undeploys.

Specified by:
  `unwindUndeploys` in interface `GridCachePreloader`
Overrides:
  `unwindUndeploys` in class `GridCachePreloaderAdapter`

#### evictPartitionAsync

    public void evictPartitionAsync(GridDhtLocalPartition part)

Evicts partition asynchronously.

Specified by:
  `evictPartitionAsync` in interface `GridCachePreloader`
Overrides:
  `evictPartitionAsync` in class `GridCachePreloaderAdapter`
Parameters:
  `part` - Partition.

#### dumpDebugInfo

    public void dumpDebugInfo()

Dumps debug information.

Specified by:
  `dumpDebugInfo` in interface `GridCachePreloader`
Overrides:
  `dumpDebugInfo` in class `GridCachePreloaderAdapter`

2018 Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Fabric | : ver. 2.4.0
Release Date | : March 5 2018