org.jboss.cache.statetransfer
Class DefaultStateTransferManager

java.lang.Object
  extended by org.jboss.cache.statetransfer.DefaultStateTransferManager
All Implemented Interfaces:
StateTransferManager
Direct Known Subclasses:
LegacyStateTransferManager

public class DefaultStateTransferManager
extends Object
implements StateTransferManager

The default state transfer manager to be used when using MVCC locking.


Field Summary
protected  CacheSPI cache
           
protected  Configuration configuration
           
protected  StateTransferGenerator generator
           
protected  StateTransferIntegrator integrator
           
protected static org.apache.commons.logging.Log log
           
protected  Marshaller marshaller
           
static String PARTIAL_STATE_DELIMITER
           
protected  RegionManager regionManager
           
protected  long stateRetrievalTimeout
           
static NodeData STREAMING_DELIMITER_NODE
           
protected static boolean trace
           
 
Constructor Summary
DefaultStateTransferManager()
           
 
Method Summary
 void getState(ObjectOutputStream out, Fqn fqn, long timeout, boolean force, boolean suppressErrors)
          Writes the state for the portion of the tree named by fqn to the provided OutputStream.
 void injectDependencies(CacheSPI cache, Marshaller marshaller, RegionManager regionManager, Configuration configuration, CacheLoaderManager cacheLoaderManager, StateTransferIntegrator integrator, StateTransferGenerator generator)
           
 void setState(ObjectInputStream in, Fqn targetRoot)
          Set the portion of the cache rooted in targetRoot to match the given state.
protected  void setState(ObjectInputStream state, NodeSPI targetRoot)
          Set the portion of the cache rooted in targetRoot to match the given state.
 void start()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected static final org.apache.commons.logging.Log log

trace

protected static final boolean trace

STREAMING_DELIMITER_NODE

public static final NodeData STREAMING_DELIMITER_NODE

PARTIAL_STATE_DELIMITER

public static final String PARTIAL_STATE_DELIMITER
See Also:
Constant Field Values

cache

protected CacheSPI cache

marshaller

protected Marshaller marshaller

regionManager

protected RegionManager regionManager

configuration

protected Configuration configuration

stateRetrievalTimeout

protected long stateRetrievalTimeout

integrator

protected StateTransferIntegrator integrator

generator

protected StateTransferGenerator generator
Constructor Detail

DefaultStateTransferManager

public DefaultStateTransferManager()
Method Detail

injectDependencies

public void injectDependencies(CacheSPI cache,
                               Marshaller marshaller,
                               RegionManager regionManager,
                               Configuration configuration,
                               CacheLoaderManager cacheLoaderManager,
                               StateTransferIntegrator integrator,
                               StateTransferGenerator generator)

start

public void start()

getState

public void getState(ObjectOutputStream out,
                     Fqn fqn,
                     long timeout,
                     boolean force,
                     boolean suppressErrors)
              throws Exception
Description copied from interface: StateTransferManager
Writes the state for the portion of the tree named by fqn to the provided OutputStream.

Specified by:
getState in interface StateTransferManager
Parameters:
out - stream to write state to
fqn - Fqn indicating the uppermost node in the portion of the tree whose state should be returned.
timeout - max number of millis this method should wait to acquire any locks, if necessary, on the nodes being transferred
force - if locks are needed and cannot be acquired after timeout millis, should the lock acquisition be forced, and any existing transactions holding locks on the nodes be rolled back?
suppressErrors - if true, all exceptions are logged but not propagated.
Throws:
Exception - in event of error

setState

public void setState(ObjectInputStream in,
                     Fqn targetRoot)
              throws Exception
Description copied from interface: StateTransferManager
Set the portion of the cache rooted in targetRoot to match the given state. Updates the contents of targetRoot to reflect those in new_state.

NOTE: This method performs no locking of nodes; it is up to the caller to lock targetRoot before calling this method.

This method will use any ClassLoader needed as defined by the active Region in the RegionManager, pertaining to the targetRoot passed in.

Specified by:
setState in interface StateTransferManager
Parameters:
in - an input stream containing the state
targetRoot - fqn of the node into which the state should be integrated
Throws:
Exception - In event of error

setState

protected void setState(ObjectInputStream state,
                        NodeSPI targetRoot)
                 throws Exception
Set the portion of the cache rooted in targetRoot to match the given state. Updates the contents of targetRoot to reflect those in new_state.

NOTE: This method performs no locking of nodes; it is up to the caller to lock targetRoot before calling this method.

Parameters:
state - a serialized byte[][] array where element 0 is the transient state (or null) , and element 1 is the persistent state (or null)
targetRoot - node into which the state should be integrated
Throws:
Exception


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