org.jboss.cache.lock
Class LockManager

java.lang.Object
  extended by org.jboss.cache.lock.LockManager

public class LockManager
extends Object

Since:
2.2
Author:
Mircea.Markus@jboss.com

Constructor Summary
LockManager()
           
 
Method Summary
 void acquireLocksOnChildren(NodeSPI parentNode, NodeLock.LockType lockType, InvocationContext ctx)
           
 void acquireLocksOnChildren(NodeSPI parentNode, NodeLock.LockType lockType, InvocationContext ctx, TransactionEntry entry, boolean addChildrenToDeletedList)
          Acquires nodes on the children of this node.
 boolean acquireLocksWithTimeout(InvocationContext ctx, Fqn fqn, NodeLock.LockType lockType, boolean createIfNotExists, boolean zeroLockTimeout, boolean acquireLockOnParent, boolean reverseRemoveCheck, List<NodeSPI> createdNodes, boolean skipNotification)
           
 void inject(Configuration configuration, DataContainer dataContainer, TransactionTable txTable, CommandsFactory commandsFactory)
           
 boolean lock(InvocationContext ctx, Fqn fqn, NodeLock.LockType lockType, boolean createIfNotExists, long timeout, boolean acquireWriteLockOnParent, boolean reverseRemoveCheck, List<NodeSPI> createdNodes, boolean skipNotification)
          Acquires locks on the node and on its parrents.
 void manageReverseRemove(GlobalTransaction gtx, NodeSPI childNode, boolean reverseRemoveCheck, List createdNodes)
          Test if this node needs to be 'undeleted' reverse the "remove" if the node has been previously removed in the same tx, if this operation is a put()
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LockManager

public LockManager()
Method Detail

inject

public void inject(Configuration configuration,
                   DataContainer dataContainer,
                   TransactionTable txTable,
                   CommandsFactory commandsFactory)

acquireLocksWithTimeout

public boolean acquireLocksWithTimeout(InvocationContext ctx,
                                       Fqn fqn,
                                       NodeLock.LockType lockType,
                                       boolean createIfNotExists,
                                       boolean zeroLockTimeout,
                                       boolean acquireLockOnParent,
                                       boolean reverseRemoveCheck,
                                       List<NodeSPI> createdNodes,
                                       boolean skipNotification)
                                throws InterruptedException
Throws:
InterruptedException

lock

public boolean lock(InvocationContext ctx,
                    Fqn fqn,
                    NodeLock.LockType lockType,
                    boolean createIfNotExists,
                    long timeout,
                    boolean acquireWriteLockOnParent,
                    boolean reverseRemoveCheck,
                    List<NodeSPI> createdNodes,
                    boolean skipNotification)
             throws TimeoutException,
                    LockingException,
                    InterruptedException
Acquires locks on the node and on its parrents. Read locks are acquired for exsiting ancestors, with two exceptions: 1) createIfNotExists is true. If an ancestor is created on the fly, then an WL is acquired by default 2) acquireWriteLockOnParent is true. If so AND Node.isLockForChildInsertRemove() then a read lock will be aquired for the parent of the node.

Parameters:
createIfNotExists - if true, then missing nodes will be cretaed on the fly. If false, method returns if we reach a node that does not exists
reverseRemoveCheck - see manageReverseRemove(org.jboss.cache.transaction.GlobalTransaction, org.jboss.cache.NodeSPI, boolean, java.util.List)
createdNodes - a list to which any nodes created can register their Fqns so that calling code is aware of which nodes have been newly created.
skipNotification -
Throws:
TimeoutException
LockingException
InterruptedException

manageReverseRemove

public void manageReverseRemove(GlobalTransaction gtx,
                                NodeSPI childNode,
                                boolean reverseRemoveCheck,
                                List createdNodes)
Test if this node needs to be 'undeleted' reverse the "remove" if the node has been previously removed in the same tx, if this operation is a put()


acquireLocksOnChildren

public void acquireLocksOnChildren(NodeSPI parentNode,
                                   NodeLock.LockType lockType,
                                   InvocationContext ctx)
                            throws InterruptedException
Throws:
InterruptedException

acquireLocksOnChildren

public void acquireLocksOnChildren(NodeSPI parentNode,
                                   NodeLock.LockType lockType,
                                   InvocationContext ctx,
                                   TransactionEntry entry,
                                   boolean addChildrenToDeletedList)
                            throws InterruptedException
Acquires nodes on the children of this node. nodes on the node itself are not aquired. If the supplied parent node is null the method returns(no op).

Throws:
InterruptedException


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