[jbosscache-commits] JBoss Cache SVN: r8548 - core/support-branches/3.2.8.GA_JBCACHE-1620/src/main/java/org/jboss/cache/lock.

jbosscache-commits at lists.jboss.org jbosscache-commits at lists.jboss.org
Thu Aug 2 17:22:33 EDT 2012


Author: dereed
Date: 2012-08-02 17:22:33 -0400 (Thu, 02 Aug 2012)
New Revision: 8548

Modified:
   core/support-branches/3.2.8.GA_JBCACHE-1620/src/main/java/org/jboss/cache/lock/PessimisticNodeBasedLockManager.java
Log:
[JBPAPP-9626] Backport JBCACHE-1620


Modified: core/support-branches/3.2.8.GA_JBCACHE-1620/src/main/java/org/jboss/cache/lock/PessimisticNodeBasedLockManager.java
===================================================================
--- core/support-branches/3.2.8.GA_JBCACHE-1620/src/main/java/org/jboss/cache/lock/PessimisticNodeBasedLockManager.java	2012-08-02 21:20:23 UTC (rev 8547)
+++ core/support-branches/3.2.8.GA_JBCACHE-1620/src/main/java/org/jboss/cache/lock/PessimisticNodeBasedLockManager.java	2012-08-02 21:22:33 UTC (rev 8548)
@@ -146,14 +146,19 @@
                // if the new node is to be marked as deleted, do not notify!
                PessimisticUnversionedNode parentInternalNode = (PessimisticUnversionedNode) parent.getDelegationTarget();
                currentNode = parentInternalNode.addChildAndAcquireLock(childName, !skipNotification, new LockAcquirer(ctx, WRITE, timeout, owner));
-               skipLockAcquire = true;
-               if (!created)
+
+               //JBCACHE-1620 make sure we created and locked the node, not a different thread
+               if ( currentNode.getLock().isOwner(owner) )
                {
-                  created = true;
-                  createdLevel = currentIndex;
+                  skipLockAcquire = true;
+                  if (!created)
+                  {
+                     created = true;
+                     createdLevel = currentIndex;
+                  }
+                  if (trace) log.trace("Child node was null, so created child node " + childName);
+                  if (createdNodes != null) createdNodes.add(currentNode);
                }
-               if (trace) log.trace("Child node was null, so created child node " + childName);
-               if (createdNodes != null) createdNodes.add(currentNode);
             }
             else
             {



More information about the jbosscache-commits mailing list