[jboss-cvs] JBossCache/src/org/jboss/cache/interceptors ...
Brian Stansberry
brian.stansberry at jboss.com
Mon Jan 29 17:42:18 EST 2007
User: bstansberry
Date: 07/01/29 17:42:18
Modified: src/org/jboss/cache/interceptors
PessimisticLockInterceptor.java
Log:
[JBCACHE-955] Add LockParentForChildInsertRemove
Revision Changes Path
1.45 +14 -9 JBossCache/src/org/jboss/cache/interceptors/PessimisticLockInterceptor.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: PessimisticLockInterceptor.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/interceptors/PessimisticLockInterceptor.java,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -b -r1.44 -r1.45
--- PessimisticLockInterceptor.java 17 Jan 2007 16:24:06 -0000 1.44
+++ PessimisticLockInterceptor.java 29 Jan 2007 22:42:18 -0000 1.45
@@ -36,12 +36,14 @@
* current method and unlock when the method returns.
*
* @author Bela Ban
- * @version $Id: PessimisticLockInterceptor.java,v 1.44 2007/01/17 16:24:06 msurtani Exp $
+ * @version $Id: PessimisticLockInterceptor.java,v 1.45 2007/01/29 22:42:18 bstansberry Exp $
*/
public class PessimisticLockInterceptor extends Interceptor
{
private TransactionTable tx_table = null;
+ boolean writeLockOnChildInsertRemove = true;
+
/**
* Map<Object, java.util.List>. Keys = threads, values = lists of locks held by that thread
*/
@@ -56,6 +58,7 @@
tx_table = cache.getTransactionTable();
lock_table = cache.getLockTable();
lock_acquisition_timeout = cache.getConfiguration().getLockAcquisitionTimeout();
+ writeLockOnChildInsertRemove = cache.getConfiguration().getLockParentForChildInsertRemove();
}
@@ -363,6 +366,8 @@
// write lock forced!!
if (cache.getInvocationContext().getOptionOverrides().isForceWriteLock()) return true;
+ if (writeLockOnChildInsertRemove)
+ {
if (isRemoveOperation && currentNodeIndex == treeNodeSize - 2)
{
return true;// we're doing a remove and we've reached the PARENT node of the target to be removed.
@@ -372,7 +377,7 @@
{
return createIfNotExists;// we're at a node in the tree, not yet at the target node, and we need to create the next node. So we need a WL here.
}
-
+ }
return lock_type == NodeLock.LockType.WRITE && isTargetNode(currentNodeIndex, treeNodeSize) && (createIfNotExists || isRemoveOperation);//normal operation, write lock explicitly requested and this is the target to be written to.
}
More information about the jboss-cvs-commits
mailing list