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 Modifier and Type Field Description static longDFLT_PRELOAD_RESEND_TIMEOUTDefault preload resend timeout.-
Fields inherited from class org.apache.ignite.internal.processors.cache.GridCachePreloaderAdapter
ctx, grp, log
-
-
Constructor Summary
Constructors Constructor Description GridDhtPreloader(CacheGroupContext grp)
-
Method Summary
-
Methods inherited from class org.apache.ignite.internal.processors.cache.GridCachePreloaderAdapter
batchesPrefetchCount, batchSize, dumpDebugInfo, throttle, timeout
-
-
-
-
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:
startin interfaceGridCachePreloader- Overrides:
startin classGridCachePreloaderAdapter
-
onKernalStop
public void onKernalStop()
Kernal stop callback.- Specified by:
onKernalStopin interfaceGridCachePreloader- Overrides:
onKernalStopin classGridCachePreloaderAdapter
-
disableRebalancingCancellationOptimization
public boolean disableRebalancingCancellationOptimization()
- Returns:
- Rebalance cancellation optimization flag.
-
onInitialExchangeComplete
public void onInitialExchangeComplete(@Nullable @Nullable Throwable err)Callback by exchange manager when initial partition exchange is complete.- Specified by:
onInitialExchangeCompletein interfaceGridCachePreloader- Overrides:
onInitialExchangeCompletein classGridCachePreloaderAdapter- Parameters:
err- Error, if any happened on initial exchange.
-
onTopologyChanged
public void onTopologyChanged(GridDhtPartitionsExchangeFuture lastFut)
- Specified by:
onTopologyChangedin interfaceGridCachePreloader- Overrides:
onTopologyChangedin classGridCachePreloaderAdapter- Parameters:
lastFut- Last future.
-
generateAssignments
public GridDhtPreloaderAssignments generateAssignments(GridDhtPartitionExchangeId exchId, GridDhtPartitionsExchangeFuture exchFut)
- Overrides:
generateAssignmentsin classGridCachePreloaderAdapter- Parameters:
exchId- Exchange ID.exchFut- Completed exchange future. Can benullif forced or reassigned generation occurs.- Returns:
- Partition assignments which will be requested from supplier nodes.
-
onReconnected
public void onReconnected()
Client reconnected callback.- Specified by:
onReconnectedin interfaceGridCachePreloader- Overrides:
onReconnectedin classGridCachePreloaderAdapter
-
handleSupplyMessage
public void handleSupplyMessage(UUID nodeId, GridDhtPartitionSupplyMessage s)
Handles Supply message.- Specified by:
handleSupplyMessagein interfaceGridCachePreloader- Overrides:
handleSupplyMessagein classGridCachePreloaderAdapter- Parameters:
nodeId- Node Id.s- Supply message.
-
handleDemandMessage
public void handleDemandMessage(int idx, UUID nodeId, GridDhtPartitionDemandMessage d)Handles Demand message.- Specified by:
handleDemandMessagein interfaceGridCachePreloader- Overrides:
handleDemandMessagein classGridCachePreloaderAdapter- Parameters:
idx- Index.nodeId- Node Id.d- Demand message.
-
prepare
public GridDhtPartitionDemander.RebalanceFuture prepare(GridDhtPartitionExchangeId exchId, @Nullable @Nullable GridDhtPartitionsExchangeFuture exchFut, long rebalanceId, GridDhtPartitionDemander.RebalanceFuture next, @Nullable @Nullable GridCompoundFuture<Boolean,Boolean> forcedRebFut, GridCompoundFuture<Boolean,Boolean> compatibleRebFut)
- Specified by:
preparein interfaceGridCachePreloader- Overrides:
preparein classGridCachePreloaderAdapter- Parameters:
exchId- Exchange ID.exchFut- Completed exchange future. Can benullif forced or reassigned generation occurs.rebalanceId- Rebalance id created by exchange thread.next- Rebalance future follows after the current one.forcedRebFut- External future for forced rebalance.compatibleRebFut- Future for waiting for compatible rebalances.- Returns:
- Future if rebalance was planned or null.
-
startFuture
public IgniteInternalFuture<Object> startFuture()
Description copied from class:GridCachePreloaderAdapter- Specified by:
startFuturein interfaceGridCachePreloader- Overrides:
startFuturein classGridCachePreloaderAdapter- Returns:
- Start future.
-
syncFuture
public IgniteInternalFuture<?> syncFuture()
- Specified by:
syncFuturein interfaceGridCachePreloader- Overrides:
syncFuturein classGridCachePreloaderAdapter- Returns:
- Future which will complete when initial preloading is finished.
-
rebalanceFuture
public IgniteInternalFuture<Boolean> rebalanceFuture()
- Specified by:
rebalanceFuturein interfaceGridCachePreloader- Overrides:
rebalanceFuturein classGridCachePreloaderAdapter- Returns:
- Future which will complete when preloading finishes on current topology.
Future result is
truein case rebalancing successfully finished at current topology. Future result isfalsein case rebalancing cancelled or finished with missed partitions and will be restarted at current or pending topology.
-
tryFinishEviction
public void tryFinishEviction(GridDhtLocalPartition part)
- Parameters:
part- Evicted partition.
-
needForceKeys
public boolean needForceKeys()
- Specified by:
needForceKeysin interfaceGridCachePreloader- Overrides:
needForceKeysin classGridCachePreloaderAdapter- Returns:
trueif 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:
requestin interfaceGridCachePreloader- Overrides:
requestin classGridCachePreloaderAdapter- Parameters:
cctx- Cache context.req- Message with keys to request.topVer- Topology version,-1if 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:GridCachePreloaderAdapterRequests that preloader sends the request for the key.- Specified by:
requestin interfaceGridCachePreloader- Overrides:
requestin classGridCachePreloaderAdapter- Parameters:
keys- Keys to request.cctx- Cache context.topVer- Topology version,-1if not required.- Returns:
- Future for request.
-
forceRebalance
public IgniteInternalFuture<Boolean> forceRebalance()
Force Rebalance process.- Specified by:
forceRebalancein interfaceGridCachePreloader- Overrides:
forceRebalancein classGridCachePreloaderAdapter
-
pause
public void pause()
Pause preloader.- Specified by:
pausein interfaceGridCachePreloader- Overrides:
pausein classGridCachePreloaderAdapter
-
resume
public void resume()
Resume preloader.- Specified by:
resumein interfaceGridCachePreloader- Overrides:
resumein classGridCachePreloaderAdapter
-
finishPreloading
public void finishPreloading(AffinityTopologyVersion topVer, long rebalanceId)
Finish preloading for given topology version.- Specified by:
finishPreloadingin interfaceGridCachePreloader- Overrides:
finishPreloadingin classGridCachePreloaderAdapter- Parameters:
topVer- Topology version.rebalanceId- Rebalance id.
-
supplier
public GridDhtPartitionSupplier supplier()
Return supplier.- Returns:
- Supplier.
-
supplier
public void supplier(GridDhtPartitionSupplier supplier)
- Parameters:
supplier- Supplier.
-
demander
public GridDhtPartitionDemander demander()
Return demander.- Returns:
- Demander.
-
demander
public void demander(GridDhtPartitionDemander demander)
- Parameters:
demander- Demander.
-
-