Author: manik.surtani(a)jboss.com
Date: 2007-11-06 11:36:02 -0500 (Tue, 06 Nov 2007)
New Revision: 4730
Modified:
core/trunk/src/main/java/org/jboss/cache/interceptors/PessimisticLockInterceptor.java
Log:
Much better behaviour with JBCACHE-1165. Better logging, and added a null check
Modified:
core/trunk/src/main/java/org/jboss/cache/interceptors/PessimisticLockInterceptor.java
===================================================================
---
core/trunk/src/main/java/org/jboss/cache/interceptors/PessimisticLockInterceptor.java 2007-11-06
15:13:18 UTC (rev 4729)
+++
core/trunk/src/main/java/org/jboss/cache/interceptors/PessimisticLockInterceptor.java 2007-11-06
16:36:02 UTC (rev 4730)
@@ -315,12 +315,12 @@
}
boolean created = false;
- if (log.isTraceEnabled()) log.trace("Directly got child node " +
child_name + ". Hash code is " + (child_node == null ? "null" :
child_node.hashCode()));
+ if (log.isTraceEnabled()) log.trace("Directly got child node " +
child_name);
if (child_node == null && createIfNotExists)
{
child_node = n.addChildDirect(new Fqn(child_name));
created = true;
- if (log.isTraceEnabled()) log.trace("Created child node " +
child_name + ". Hash code is " + (child_node == null ? "null" :
child_node.hashCode()));
+ if (log.isTraceEnabled()) log.trace("Child node was null, so created
child node " + child_name);
}
if (child_node == null)
@@ -361,12 +361,15 @@
acquireNodeLock(child_node, owner, gtx, lockTypeRequired, timeout);
// make sure the lock we acquired isn't on a deleted node/is an orphan!!
- if (child_node != cache.peek(child_node.getFqn(), true))
+ NodeSPI repeek = cache.peek(child_node.getFqn(), true);
+ if (repeek != null && child_node != repeek)
{
+ log.trace("Was waiting for and obtained a lock on a node that
doesn't exist anymore! Attempting lock acquisition again.");
// we have an orphan!! Lose the unnecessary lock and re-acquire the lock (and
potentially recreate the node).
child_node.getLock().release(owner);
// do the loop again, but don't assign child_node to n so that child_node
is processed again.
+ i--;
continue;
}
Show replies by date