Infinispan Distribution 5.2.6.Final-redhat-2

org.infinispan.statetransfer
Class InboundTransferTask

java.lang.Object
  extended by 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
InboundTransferTask(Set<Integer> segments, Address source, int topologyId, StateConsumerImpl stateConsumer, RpcManager rpcManager, CommandsFactory commandsFactory, long timeout, String cacheName)
           
 
Method Summary
 boolean awaitCompletion()
          Wait until all segments are received, cancelled, or the task is terminated abruptly by terminate().
 void cancel()
           
 void cancelSegments(Set<Integer> cancelledSegments)
          Cancels a subset of the segments.
 Set<Integer> getSegments()
           
 Address getSource()
           
 Set<Integer> getUnfinishedSegments()
           
 void onStateReceived(int segmentId, boolean isLastChunk)
           
 boolean requestSegments()
          Send START_STATE_TRANSFER request to source node.
 void terminate()
          Terminate abruptly regardless if the segments were received or not.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

InboundTransferTask

public InboundTransferTask(Set<Integer> segments,
                           Address source,
                           int topologyId,
                           StateConsumerImpl stateConsumer,
                           RpcManager rpcManager,
                           CommandsFactory commandsFactory,
                           long timeout,
                           String cacheName)
Method Detail

getSegments

public Set<Integer> getSegments()

getUnfinishedSegments

public Set<Integer> getUnfinishedSegments()

getSource

public Address getSource()

requestSegments

public boolean requestSegments()
Send START_STATE_TRANSFER request to source node.


cancelSegments

public void cancelSegments(Set<Integer> cancelledSegments)
Cancels a subset of the segments. If it happens that all segments are cancelled then the whole task is marked as cancelled and completion is signalled..

Parameters:
cancelledSegments - the segments to be cancelled

cancel

public void cancel()

onStateReceived

public void onStateReceived(int segmentId,
                            boolean isLastChunk)

awaitCompletion

public boolean awaitCompletion()
                        throws InterruptedException
Wait until all segments are received, cancelled, or the task is terminated abruptly by terminate().

Returns:
true if the task completed normally or false if it was terminated abruptly
Throws:
InterruptedException - if the thread is interrupted while waiting

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

Infinispan Distribution 5.2.6.Final-redhat-2

Copyright © 2013 JBoss, a division of Red Hat. All Rights Reserved.