Package org.infinispan.statetransfer
Class InboundTransferTask
java.lang.Object
org.infinispan.statetransfer.InboundTransferTask
Inbound state transfer task. Fetches multiple data segments from a remote source node and applies them to local
cache. Instances of InboundTransferTask are created and managed by StateTransferManagerImpl. StateTransferManagerImpl
must have zero or one such task for each segment.
- Since:
- 5.2
- Author:
- anistor@redhat.com
-
Constructor Summary
ConstructorsConstructorDescriptionInboundTransferTask(org.infinispan.commons.util.IntSet segments, Address source, int topologyId, RpcManager rpcManager, CommandsFactory commandsFactory, long timeout, String cacheName, boolean applyState) -
Method Summary
Modifier and TypeMethodDescriptionvoidcancel()Cancels all the segments and marks them as finished, sends a cancel command, then completes the task.voidcancelSegments(org.infinispan.commons.util.IntSet cancelledSegments) Cancels a set of segments and marks them as finished.org.infinispan.commons.util.IntSetReturns a copy of segments currently tied to this taskorg.infinispan.commons.util.IntSetbooleanbooleanvoidonStateReceived(int segmentId, boolean isLastChunk) Send START_STATE_TRANSFER request to source node.voidTerminate abruptly regardless if the segments were received or not.toString()
-
Constructor Details
-
InboundTransferTask
public InboundTransferTask(org.infinispan.commons.util.IntSet segments, Address source, int topologyId, RpcManager rpcManager, CommandsFactory commandsFactory, long timeout, String cacheName, boolean applyState)
-
-
Method Details
-
getSegments
public org.infinispan.commons.util.IntSet getSegments()Returns a copy of segments currently tied to this task- Returns:
- copy of segments
-
getUnfinishedSegments
public org.infinispan.commons.util.IntSet getUnfinishedSegments()- Returns:
- a copy of the unfinished segments
-
getSource
-
requestSegments
Send START_STATE_TRANSFER request to source node.- Returns:
- a
CompletableFuturethat completes when the transfer is done.
-
cancelSegments
public void cancelSegments(org.infinispan.commons.util.IntSet cancelledSegments) Cancels a set of segments and marks them as finished. If all segments are cancelled then the whole task is cancelled, as if cancel() was called.- Parameters:
cancelledSegments- the segments to be cancelled
-
cancel
public void cancel()Cancels all the segments and marks them as finished, sends a cancel command, then completes the task. -
isCancelled
public boolean isCancelled() -
onStateReceived
public void onStateReceived(int segmentId, boolean isLastChunk) -
isCompletedSuccessfully
public boolean isCompletedSuccessfully() -
terminate
public void terminate()Terminate abruptly regardless if the segments were received or not. This is used when the source node is no longer alive. -
toString
-