org.jboss.cache.statetransfer
Class StateTransferManager

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

public class StateTransferManager
extends Object


Field Summary
protected static org.apache.commons.logging.Log log
           
static String PARTIAL_STATE_DELIMITER
           
static NodeData STREAMING_DELIMITER_NODE
           
 
Constructor Summary
StateTransferManager()
           
StateTransferManager(CacheSPI cache)
           
 
Method Summary
protected  void acquireLocksForStateTransfer(NodeSPI root, Object lockOwner, long timeout, boolean lockChildren, boolean force)
          Acquires locks on a root node for an owner for state transfer.
 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.
protected  StateTransferGenerator getStateTransferGenerator()
           
protected  StateTransferIntegrator getStateTransferIntegrator(ObjectInputStream istream, Fqn fqn)
           
protected  void releaseStateTransferLocks(NodeSPI root, Object lockOwner, boolean childrenLocked)
          Releases all state transfer locks acquired.
 void setState(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 String PARTIAL_STATE_DELIMITER
See Also:
Constant Field Values
Constructor Detail

StateTransferManager

public StateTransferManager()

StateTransferManager

public StateTransferManager(CacheSPI cache)
Method Detail

getState

public void getState(ObjectOutputStream out,
                     Fqn fqn,
                     long timeout,
                     boolean force,
                     boolean suppressErrors)
              throws 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:
Throwable - in event of error

setState

public void setState(ObjectInputStream in,
                     Fqn 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.

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:
Exception - In event of error

acquireLocksForStateTransfer

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

Throws:
Exception

releaseStateTransferLocks

protected void releaseStateTransferLocks(NodeSPI root,
                                         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(ObjectInputStream istream,
                                                             Fqn fqn)
                                                      throws Exception
Throws:
Exception


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