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 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

      public Address getSource()
    • requestSegments

      public CompletionStage<Void> requestSegments()
      Send START_STATE_TRANSFER request to source node.
      Returns:
      a CompletableFuture that 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

      public String toString()
      Overrides:
      toString in class Object