org.jboss.cache.statetransfer
Class StateTransferManager

java.lang.Object
  extended by org.jboss.cache.statetransfer.StateTransferManager

public class StateTransferManager
extends java.lang.Object


Field Summary
protected static org.apache.commons.logging.Log log
           
static java.lang.String PARTIAL_STATE_DELIMITER
           
static NodeData STREAMING_DELIMITER_NODE
           
 
Constructor Summary
StateTransferManager(CacheImpl cache)
           
 
Method Summary
protected  void acquireLocksForStateTransfer(NodeSPI root, java.lang.Object lockOwner, long timeout, boolean lockChildren, boolean force)
          Acquires locks on a root node for an owner for state transfer.
 void getState(java.io.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.
protected  StateTransferGenerator getStateTransferGenerator()
           
protected  StateTransferIntegrator getStateTransferIntegrator(java.io.ObjectInputStream istream, Fqn fqn)
           
 CacheImpl getTreeCache()
           
protected  void releaseStateTransferLocks(NodeSPI root, java.lang.Object lockOwner, boolean childrenLocked)
          Releases all state transfer locks acquired.
 void setState(java.io.ObjectInputStream in, Fqn targetRoot)
          Set the portion of the cache rooted in targetRoot to match the given state.
 
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

STREAMING_DELIMITER_NODE

public static final NodeData STREAMING_DELIMITER_NODE

PARTIAL_STATE_DELIMITER

public static final java.lang.String PARTIAL_STATE_DELIMITER
See Also:
Constant Field Values
Constructor Detail

StateTransferManager

public StateTransferManager(CacheImpl cache)
Method Detail

getTreeCache

public CacheImpl getTreeCache()

getState

public void getState(java.io.ObjectOutputStream out,
                     Fqn fqn,
                     long timeout,
                     boolean force,
                     boolean suppressErrors)
              throws java.lang.Throwable
Writes the state for the portion of the tree named by fqn to the provided OutputStream.

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 ms this method should wait to acquire a read lock on the nodes being transferred
force - if a read lock cannot be acquired after timeout ms, should the lock acquisition be forced, and any existing transactions holding locks on the nodes be rolled back? NOTE: In release 1.2.4, this parameter has no effect.
suppressErrors - should any Throwable thrown be suppressed?
Throws:
java.lang.Throwable - in event of error

setState

public void setState(java.io.ObjectInputStream in,
                     Fqn targetRoot)
              throws java.lang.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.

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

Parameters:
in - an input stream containing the state
targetRoot - fqn of the node into which the state should be integrated
Throws:
java.lang.Exception - In event of error

acquireLocksForStateTransfer

protected void acquireLocksForStateTransfer(NodeSPI root,
                                            java.lang.Object lockOwner,
                                            long timeout,
                                            boolean lockChildren,
                                            boolean force)
                                     throws java.lang.Exception
Acquires locks on a root node for an owner for state transfer.

Throws:
java.lang.Exception

releaseStateTransferLocks

protected void releaseStateTransferLocks(NodeSPI root,
                                         java.lang.Object lockOwner,
                                         boolean childrenLocked)
Releases all state transfer locks acquired.

See Also:
acquireLocksForStateTransfer(org.jboss.cache.NodeSPI, java.lang.Object, long, boolean, boolean)

getStateTransferGenerator

protected StateTransferGenerator getStateTransferGenerator()

getStateTransferIntegrator

protected StateTransferIntegrator getStateTransferIntegrator(java.io.ObjectInputStream istream,
                                                             Fqn fqn)
                                                      throws java.lang.Exception
Throws:
java.lang.Exception