Package org.infinispan.statetransfer
Class InboundTransferTask
- java.lang.Object
-
- org.infinispan.statetransfer.InboundTransferTask
-
public class InboundTransferTask extends Object
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
Constructors Constructor Description InboundTransferTask(IntSet segments, Address source, int topologyId, RpcManager rpcManager, org.infinispan.commands.CommandsFactory commandsFactory, long timeout, String cacheName, boolean applyState)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcancel()Cancels all the segments and marks them as finished, sends a cancel command, then completes the task.voidcancelSegments(IntSet cancelledSegments)Cancels a set of segments and marks them as finished.IntSetgetSegments()Returns a copy of segments currently tied to this taskAddressgetSource()IntSetgetUnfinishedSegments()Returns a copy of the unfinished segmentsbooleanisCancelled()booleanisCompletedSuccessfully()voidonStateReceived(int segmentId, boolean isLastChunk)CompletableFuture<Void>requestKeys()CompletableFuture<Void>requestSegments()Send START_STATE_TRANSFER request to source node.voidterminate()Terminate abruptly regardless if the segments were received or not.StringtoString()
-
-
-
Constructor Detail
-
InboundTransferTask
public InboundTransferTask(IntSet segments, Address source, int topologyId, RpcManager rpcManager, org.infinispan.commands.CommandsFactory commandsFactory, long timeout, String cacheName, boolean applyState)
-
-
Method Detail
-
getSegments
public IntSet getSegments()
Returns a copy of segments currently tied to this task- Returns:
- copy of segments
-
getUnfinishedSegments
public IntSet getUnfinishedSegments()
Returns a copy of the unfinished segments- Returns:
-
getSource
public Address getSource()
-
requestSegments
public CompletableFuture<Void> requestSegments()
Send START_STATE_TRANSFER request to source node.- Returns:
- a
CompletableFuturethat completes when the transfer is done.
-
requestKeys
public CompletableFuture<Void> requestKeys()
-
cancelSegments
public void cancelSegments(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.
-
-