[jbosscache-commits] JBoss Cache SVN: r4848 - in core/branches/1.4.X: tests/functional/org/jboss/cache/lock/pessimistic and 1 other directory.

jbosscache-commits at lists.jboss.org jbosscache-commits at lists.jboss.org
Wed Dec 12 17:42:28 EST 2007


Author: bstansberry at jboss.com
Date: 2007-12-12 17:42:28 -0500 (Wed, 12 Dec 2007)
New Revision: 4848

Removed:
   core/branches/1.4.X/tests/functional/org/jboss/cache/lock/pessimistic/ConcurrentPutRemoveTest.java
Modified:
   core/branches/1.4.X/src/org/jboss/cache/interceptors/PessimisticLockInterceptor.java
Log:
[JBCACHE-1235] Revert JBCACHE-1165 on 1.4.X branch

Modified: core/branches/1.4.X/src/org/jboss/cache/interceptors/PessimisticLockInterceptor.java
===================================================================
--- core/branches/1.4.X/src/org/jboss/cache/interceptors/PessimisticLockInterceptor.java	2007-12-12 21:52:59 UTC (rev 4847)
+++ core/branches/1.4.X/src/org/jboss/cache/interceptors/PessimisticLockInterceptor.java	2007-12-12 22:42:28 UTC (rev 4848)
@@ -118,7 +118,10 @@
             fqn = (Fqn) args[1];
             lock_type = DataNode.LOCK_TYPE_WRITE;
             recursive = true; // remove node and *all* child nodes
-            createIfNotExists = true;
+            // BES 2007/12/12 -- Revert JBCACHE-1165 fix as it causes endless loop
+            // in TransactionTest.testDoubleNodeRemoval, plus another failure 
+            // in that test
+//            createIfNotExists = true;
             // JBCACHE-871 We need to store the node
             storeLockedNode = true;
             break;
@@ -308,20 +311,23 @@
 
          // Try to acquire the lock; recording that we did if successful
          acquireNodeLock(child_node, owner, gtx, currentLockType, lock_timeout);
+         
+         // BES 2007/12/12 -- Revert JBCACHE-1165 fix as it causes endless loop
+         // in TransactionTest.testDoubleNodeRemoval, plus another failure 
+         // in that test
+//         // make sure the lock we acquired isn't on a deleted node/is an orphan!!
+//         DataNode repeek = cache.peek(child_node.getFqn());
+//         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;
+//         }
 
-         // make sure the lock we acquired isn't on a deleted node/is an orphan!!
-         DataNode repeek = cache.peek(child_node.getFqn());
-         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;
-         }
-
          if (recursive && isTargetNode(i, treeNodeSize))
          {
             {

Deleted: core/branches/1.4.X/tests/functional/org/jboss/cache/lock/pessimistic/ConcurrentPutRemoveTest.java
===================================================================
--- core/branches/1.4.X/tests/functional/org/jboss/cache/lock/pessimistic/ConcurrentPutRemoveTest.java	2007-12-12 21:52:59 UTC (rev 4847)
+++ core/branches/1.4.X/tests/functional/org/jboss/cache/lock/pessimistic/ConcurrentPutRemoveTest.java	2007-12-12 22:42:28 UTC (rev 4848)
@@ -1,104 +0,0 @@
-package org.jboss.cache.lock.pessimistic;
-
-import junit.framework.TestCase;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.jboss.cache.DummyTransactionManagerLookup;
-import org.jboss.cache.Fqn;
-import org.jboss.cache.TreeCache;
-import org.jboss.cache.lock.IsolationLevel;
-import org.jboss.cache.misc.TestingUtil;
-
-import javax.transaction.TransactionManager;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-public class ConcurrentPutRemoveTest extends TestCase
-{
-   private TransactionManager tm;
-
-   private TreeCache cache;
-
-   private final Log log = LogFactory.getLog(ConcurrentPutRemoveTest.class);
-   private List threads;
-
-
-   public void setUp() throws Exception
-   {
-      cache = new TreeCache();
-      cache.setIsolationLevel(IsolationLevel.READ_COMMITTED);
-      cache.setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
-      cache.setLockAcquisitionTimeout(1000);
-      cache.start();
-      tm = cache.getTransactionManager();
-      threads = new ArrayList();
-   }
-
-   public void tearDown() throws Exception
-   {
-      TestingUtil.killCaches(new TreeCache[]{cache});
-   }
-
-   public void testLock() throws Exception
-   {
-      for (int x = 0; x < 2; x++)
-      {
-         SeparateThread t = new SeparateThread(x);
-         threads.add(t);
-         t.start();
-      }
-      for (Iterator i = threads.iterator(); i.hasNext();)
-      {
-         SeparateThread separateThread = (SeparateThread) i.next();
-         separateThread.join();
-         if (separateThread.getException() != null)
-         {
-            throw separateThread.getException();
-         }
-      }
-   }
-
-   private class SeparateThread extends Thread
-   {
-      Exception e = null;
-
-      private int num = 0;
-
-      public SeparateThread(int num)
-      {
-         this.num = num;
-      }
-
-      public Exception getException()
-      {
-         return e;
-      }
-
-      public void run()
-      {
-         Thread.currentThread().setName("Thread:" + num);
-         try
-         {
-            for (int x = 0; x < 100; x++)
-            {
-               tm.begin();
-               log.warn("Before Remove (" + x + ")");
-               //inside transaction
-               cache.remove(Fqn.fromString("/a"));
-               log.warn("After Remove (" + x + ")");
-               tm.commit();
-               //outside transaction
-               log.warn("Before Put (" + x + ")");
-               cache.put(Fqn.fromString("/a/b/c/d"), "text" + x, "b");
-               log.warn("After Put (" + x + ")");
-            }
-         }
-         catch (Exception e)
-         {
-            this.e = e;
-         }
-      }
-   }
-
-}




More information about the jbosscache-commits mailing list