[jboss-cvs] JBossCache/src/org/jboss/cache/interceptors ...
Manik Surtani
manik at jboss.org
Tue Jun 12 03:39:50 EDT 2007
User: msurtani
Date: 07/06/12 03:39:50
Modified: src/org/jboss/cache/interceptors
PessimisticLockInterceptor.java
Log:
JBCACHE-1102
Revision Changes Path
1.54 +6 -4 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.53
retrieving revision 1.54
diff -u -b -r1.53 -r1.54
--- PessimisticLockInterceptor.java 11 Jun 2007 21:17:20 -0000 1.53
+++ PessimisticLockInterceptor.java 12 Jun 2007 07:39:50 -0000 1.54
@@ -35,7 +35,7 @@
* current method and unlock when the method returns.
*
* @author Bela Ban
- * @version $Id: PessimisticLockInterceptor.java,v 1.53 2007/06/11 21:17:20 msurtani Exp $
+ * @version $Id: PessimisticLockInterceptor.java,v 1.54 2007/06/12 07:39:50 msurtani Exp $
*/
public class PessimisticLockInterceptor extends Interceptor
{
@@ -371,7 +371,9 @@
private boolean writeLockNeeded(InvocationContext ctx, NodeLock.LockType lock_type, int currentNodeIndex, int treeNodeSize, boolean isEvictOperation, boolean isRemoveOperation, boolean createIfNotExists, Fqn targetFqn, Fqn currentFqn)
{
// write lock forced!!
- if (ctx.getOptionOverrides().isForceWriteLock()) return true;
+ boolean isTargetNode = isTargetNode(currentNodeIndex, treeNodeSize);
+
+ if (ctx.getOptionOverrides().isForceWriteLock() && isTargetNode) return true;
if (cache.getConfiguration().isLockParentForChildInsertRemove())
{
@@ -380,12 +382,12 @@
return true;// we're doing a remove and we've reached the PARENT node of the target to be removed.
}
- if (!isTargetNode(currentNodeIndex, treeNodeSize) && cache.peek(new Fqn(currentFqn, targetFqn.get(currentNodeIndex + 1)), false) == null)
+ if (!isTargetNode && cache.peek(new Fqn(currentFqn, targetFqn.get(currentNodeIndex + 1)), false) == null)
{
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 || isEvictOperation);//normal operation, write lock explicitly requested and this is the target to be written to.
+ return lock_type == NodeLock.LockType.WRITE && isTargetNode && (createIfNotExists || isRemoveOperation || isEvictOperation);//normal operation, write lock explicitly requested and this is the target to be written to.
}
private boolean isTargetNode(int nodePosition, int treeNodeSize)
More information about the jboss-cvs-commits
mailing list