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