org.infinispan.statetransfer
Class BaseStateTransferManagerImpl

java.lang.Object
  extended by org.infinispan.statetransfer.BaseStateTransferManagerImpl
All Implemented Interfaces:
CacheViewListener, StateTransferManager
Direct Known Subclasses:
DistributedStateTransferManagerImpl, DummyInvalidationStateTransferManagerImpl, ReplicatedStateTransferManagerImpl

public abstract class BaseStateTransferManagerImpl
extends Object
implements StateTransferManager, CacheViewListener

State transfer manager. Base class for the distributed and replicated implementations.


Field Summary
protected  CacheLoaderManager cacheLoaderManager
           
protected  CacheNotifier cacheNotifier
           
protected  CommandsFactory cf
           
protected  ConsistentHash chNew
           
protected  ConsistentHash chOld
           
protected  Configuration configuration
           
protected  DataContainer dataContainer
           
protected  InvocationContextContainer icc
           
protected  InterceptorChain interceptorChain
           
protected  RpcManager rpcManager
           
protected  StateTransferLock stateTransferLock
           
protected  TransactionTable transactionTable
           
 
Constructor Summary
BaseStateTransferManagerImpl()
           
 
Method Summary
 void applyLocks(Collection<LockInfo> lockInfo, Address sender, int viewId)
           
 void applyState(Collection<InternalCacheEntry> state, Address sender, int viewId)
           
 void commitView(int viewId)
          Called before committing a cache view.
protected abstract  ConsistentHash createConsistentHash(List<Address> members)
           
protected abstract  BaseStateTransferTask createStateTransferTask(int viewId, List<Address> members, boolean initialView)
           
protected  Address getAddress()
           
abstract  CacheStore getCacheStoreForStateTransfer()
           
protected abstract  long getTimeout()
           
 boolean hasJoinStarted()
           
 void init(Configuration configuration, RpcManager rpcManager, CommandsFactory cf, DataContainer dataContainer, InterceptorChain interceptorChain, InvocationContextContainer icc, CacheLoaderManager cacheLoaderManager, CacheNotifier cacheNotifier, StateTransferLock stateTransferLock, CacheViewsManager cacheViewsManager, TransactionTable transactionTable, LockContainer<?> lockContainer)
           
 boolean isJoinComplete()
           
 boolean isLastViewId(int viewId)
           
 boolean isStateTransferInProgress()
           
 void postInstallView(int viewId)
          Called after the cache view was installed successfully.
 void preInstallView()
          Called after a node left or after a merge, even if we're not preparing a new view yet we know we'll prepare one soon.
 void prepareView(CacheView pendingView, CacheView committedView)
          Called after preparing a cache view.
 void pushStateToNode(NotifyingNotifiableFuture<Object> stateTransferFuture, int viewId, Collection<Address> targets, Collection<InternalCacheEntry> state, Collection<LockInfo> lockInfo)
           
 void rollbackView(int newViewId, int committedViewId)
          Called before rolling back a cache view installation.
 boolean startStateTransfer(int viewId, Collection<Address> members, boolean initialView)
           
 void stop()
           
 void waitForJoinToComplete()
           
 void waitForJoinToStart()
           
 void waitForStateTransferToComplete()
           
 void waitForStateTransferToStart(int viewId)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.infinispan.statetransfer.StateTransferManager
isLocationInDoubt
 

Field Detail

cacheLoaderManager

protected CacheLoaderManager cacheLoaderManager

configuration

protected Configuration configuration

rpcManager

protected RpcManager rpcManager

cf

protected CommandsFactory cf

dataContainer

protected DataContainer dataContainer

interceptorChain

protected InterceptorChain interceptorChain

icc

protected InvocationContextContainer icc

cacheNotifier

protected CacheNotifier cacheNotifier

stateTransferLock

protected StateTransferLock stateTransferLock

chOld

protected volatile ConsistentHash chOld

chNew

protected volatile ConsistentHash chNew

transactionTable

protected TransactionTable transactionTable
Constructor Detail

BaseStateTransferManagerImpl

public BaseStateTransferManagerImpl()
Method Detail

init

public void init(Configuration configuration,
                 RpcManager rpcManager,
                 CommandsFactory cf,
                 DataContainer dataContainer,
                 InterceptorChain interceptorChain,
                 InvocationContextContainer icc,
                 CacheLoaderManager cacheLoaderManager,
                 CacheNotifier cacheNotifier,
                 StateTransferLock stateTransferLock,
                 CacheViewsManager cacheViewsManager,
                 TransactionTable transactionTable,
                 LockContainer<?> lockContainer)

createConsistentHash

protected abstract ConsistentHash createConsistentHash(List<Address> members)

waitForJoinToComplete

public void waitForJoinToComplete()
                           throws InterruptedException
Specified by:
waitForJoinToComplete in interface StateTransferManager
Throws:
InterruptedException

stop

public void stop()

getAddress

protected Address getAddress()

hasJoinStarted

public boolean hasJoinStarted()
Specified by:
hasJoinStarted in interface StateTransferManager

waitForJoinToStart

public void waitForJoinToStart()
                        throws InterruptedException
Specified by:
waitForJoinToStart in interface StateTransferManager
Throws:
InterruptedException

isJoinComplete

public boolean isJoinComplete()
Specified by:
isJoinComplete in interface StateTransferManager

isStateTransferInProgress

public boolean isStateTransferInProgress()
Specified by:
isStateTransferInProgress in interface StateTransferManager

waitForStateTransferToStart

public void waitForStateTransferToStart(int viewId)
                                 throws InterruptedException
Throws:
InterruptedException

waitForStateTransferToComplete

public void waitForStateTransferToComplete()
                                    throws InterruptedException
Specified by:
waitForStateTransferToComplete in interface StateTransferManager
Throws:
InterruptedException

applyState

public void applyState(Collection<InternalCacheEntry> state,
                       Address sender,
                       int viewId)
                throws InterruptedException
Specified by:
applyState in interface StateTransferManager
Throws:
InterruptedException

applyLocks

public void applyLocks(Collection<LockInfo> lockInfo,
                       Address sender,
                       int viewId)
                throws InterruptedException
Specified by:
applyLocks in interface StateTransferManager
Throws:
InterruptedException

startStateTransfer

public boolean startStateTransfer(int viewId,
                                  Collection<Address> members,
                                  boolean initialView)
                           throws TimeoutException,
                                  InterruptedException,
                                  StateTransferCancelledException
Returns:
true if the state transfer started successfully, false otherwise
Throws:
TimeoutException
InterruptedException
StateTransferCancelledException

getCacheStoreForStateTransfer

public abstract CacheStore getCacheStoreForStateTransfer()

pushStateToNode

public void pushStateToNode(NotifyingNotifiableFuture<Object> stateTransferFuture,
                            int viewId,
                            Collection<Address> targets,
                            Collection<InternalCacheEntry> state,
                            Collection<LockInfo> lockInfo)
                     throws StateTransferCancelledException
Throws:
StateTransferCancelledException

isLastViewId

public boolean isLastViewId(int viewId)

prepareView

public void prepareView(CacheView pendingView,
                        CacheView committedView)
                 throws Exception
Description copied from interface: CacheViewListener
Called after preparing a cache view.

Specified by:
prepareView in interface CacheViewListener
Throws:
Exception

commitView

public void commitView(int viewId)
Description copied from interface: CacheViewListener
Called before committing a cache view.

Specified by:
commitView in interface CacheViewListener

rollbackView

public void rollbackView(int newViewId,
                         int committedViewId)
Description copied from interface: CacheViewListener
Called before rolling back a cache view installation.

Specified by:
rollbackView in interface CacheViewListener

preInstallView

public void preInstallView()
Description copied from interface: CacheViewListener
Called after a node left or after a merge, even if we're not preparing a new view yet we know we'll prepare one soon.

Specified by:
preInstallView in interface CacheViewListener

postInstallView

public void postInstallView(int viewId)
Description copied from interface: CacheViewListener
Called after the cache view was installed successfully.

Specified by:
postInstallView in interface CacheViewListener

createStateTransferTask

protected abstract BaseStateTransferTask createStateTransferTask(int viewId,
                                                                 List<Address> members,
                                                                 boolean initialView)

getTimeout

protected abstract long getTimeout()

-->

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