Interface GridCachePreloader
-
- All Known Implementing Classes:
GridCachePreloaderAdapter,GridDhtPreloader
public interface GridCachePreloaderCache preloader that is responsible for loading cache entries either from remote nodes (for distributed cache) or anywhere else at cache startup.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description longbatchesPrefetchCount()The number of batches generated by supply node at rebalancing procedure start.intbatchSize()The supply message size in bytes to be loaded within a single rebalance batch.voiddumpDebugInfo()Dumps debug information.voidfinishPreloading(AffinityTopologyVersion topVer, long rebalanceId)Finish preloading for given topology version.IgniteInternalFuture<Boolean>forceRebalance()Force Rebalance process.voidhandleDemandMessage(int idx, UUID id, GridDhtPartitionDemandMessage d)Handles Demand message.voidhandleSupplyMessage(UUID id, GridDhtPartitionSupplyMessage s)Handles Supply message.booleanneedForceKeys()voidonInitialExchangeComplete(@Nullable Throwable err)Callback by exchange manager when initial partition exchange is complete.voidonKernalStop()Kernal stop callback.voidonReconnected()Client reconnected callback.voidonTopologyChanged(GridDhtPartitionsExchangeFuture lastFut)voidpause()Pause preloader.GridDhtPartitionDemander.RebalanceFutureprepare(GridDhtPartitionExchangeId exchId, @Nullable GridDhtPartitionsExchangeFuture exchFut, long rebalanceId, GridDhtPartitionDemander.RebalanceFuture next, @Nullable GridCompoundFuture<Boolean,Boolean> forcedRebFut, GridCompoundFuture<Boolean,Boolean> compatibleRebFut)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.voidresume()Resume preloader.voidstart()Starts preloading.IgniteInternalFuture<Object>startFuture()IgniteInternalFuture<?>syncFuture()longthrottle()Time in milliseconds to wait between rebalance messages to avoid overloading of CPU or network.longtimeout()Rebalance timeout for supply and demand messages in milliseconds.
-
-
-
Method Detail
-
start
void start() throws IgniteCheckedExceptionStarts preloading.- Throws:
IgniteCheckedException- If start failed.
-
onKernalStop
void onKernalStop()
Kernal stop callback.
-
onReconnected
void onReconnected()
Client reconnected callback.
-
onInitialExchangeComplete
void onInitialExchangeComplete(@Nullable @Nullable Throwable err)Callback by exchange manager when initial partition exchange is complete.- Parameters:
err- Error, if any happened on initial exchange.
-
prepare
GridDhtPartitionDemander.RebalanceFuture prepare(GridDhtPartitionExchangeId exchId, @Nullable @Nullable GridDhtPartitionsExchangeFuture exchFut, long rebalanceId, GridDhtPartitionDemander.RebalanceFuture next, @Nullable @Nullable GridCompoundFuture<Boolean,Boolean> forcedRebFut, GridCompoundFuture<Boolean,Boolean> compatibleRebFut)
- 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
IgniteInternalFuture<Object> startFuture()
- Returns:
- Future which will complete when preloader is safe to use.
-
syncFuture
IgniteInternalFuture<?> syncFuture()
- Returns:
- Future which will complete when initial preloading is finished.
-
rebalanceFuture
IgniteInternalFuture<Boolean> rebalanceFuture()
- 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.
-
needForceKeys
boolean needForceKeys()
- Returns:
trueif there is no need to force keys preloading (e.g. rebalancing has been completed).
-
request
GridDhtFuture<Object> request(GridCacheContext cctx, Collection<KeyCacheObject> keys, AffinityTopologyVersion topVer)
Requests that preloader sends the request for the key.- Parameters:
cctx- Cache context.keys- Keys to request.topVer- Topology version,-1if not required.- Returns:
- Future to complete when all keys are preloaded.
-
request
GridDhtFuture<Object> request(GridCacheContext cctx, GridNearAtomicAbstractUpdateRequest req, AffinityTopologyVersion topVer)
Requests that preloader sends the request for the key.- 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.
-
forceRebalance
IgniteInternalFuture<Boolean> forceRebalance()
Force Rebalance process.
-
handleSupplyMessage
void handleSupplyMessage(UUID id, GridDhtPartitionSupplyMessage s)
Handles Supply message.- Parameters:
id- Node Id.s- Supply message.
-
handleDemandMessage
void handleDemandMessage(int idx, UUID id, GridDhtPartitionDemandMessage d)Handles Demand message.- Parameters:
idx- Index.id- Node Id.d- Demand message.
-
onTopologyChanged
void onTopologyChanged(GridDhtPartitionsExchangeFuture lastFut)
- Parameters:
lastFut- Last future.
-
dumpDebugInfo
void dumpDebugInfo()
Dumps debug information.
-
pause
void pause()
Pause preloader.
-
resume
void resume()
Resume preloader.
-
timeout
long timeout()
Rebalance timeout for supply and demand messages in milliseconds.The
IgniteConfiguration.getRebalanceTimeout()will be used by default. If an Ignite's configuration value is not provided than theCacheConfiguration.getRebalanceTimeout()will be used instead.- Returns:
- Rebalance message timeout in milliseconds.
-
batchesPrefetchCount
long batchesPrefetchCount()
The number of batches generated by supply node at rebalancing procedure start.The
IgniteConfiguration.getRebalanceBatchesPrefetchCount()will be used by default. If an Ignite's configuration value is not provided than theCacheConfiguration.getRebalanceBatchesPrefetchCount()will be used instead.- Returns:
- The number of batches prefetch count.
-
throttle
long throttle()
Time in milliseconds to wait between rebalance messages to avoid overloading of CPU or network.The
IgniteConfiguration.getRebalanceThrottle()will be used by default. If an Ignite's configuration value is not provided than theCacheConfiguration.getRebalanceThrottle()will be used instead.- Returns:
- Time in milliseconds to wait between rebalance messages,
0to disable throttling.
-
batchSize
int batchSize()
The supply message size in bytes to be loaded within a single rebalance batch.The
IgniteConfiguration.getRebalanceBatchSize()will be used by default. If an Ignite's configuration value is not provided than theCacheConfiguration.getRebalanceBatchSize()will be used instead.- Returns:
- Rebalance message size in bytes.
-
finishPreloading
void finishPreloading(AffinityTopologyVersion topVer, long rebalanceId)
Finish preloading for given topology version.- Parameters:
topVer- Topology version.rebalanceId- Rebalance id.
-
-