Author: mircea.markus
Date: 2008-02-19 15:28:55 -0500 (Tue, 19 Feb 2008)
New Revision: 5357
Modified:
core/trunk/src/main/java/org/jboss/cache/interceptors/PessimisticLockInterceptor.java
core/trunk/src/test/java/org/jboss/cache/lock/pessimistic/ConcurrentPutRemoveTest.java
Log:
http://jira.jboss.com/jira/browse/JBCACHE-1165
- this test was fixed in past, but failed again.
Modified:
core/trunk/src/main/java/org/jboss/cache/interceptors/PessimisticLockInterceptor.java
===================================================================
---
core/trunk/src/main/java/org/jboss/cache/interceptors/PessimisticLockInterceptor.java 2008-02-19
19:57:56 UTC (rev 5356)
+++
core/trunk/src/main/java/org/jboss/cache/interceptors/PessimisticLockInterceptor.java 2008-02-19
20:28:55 UTC (rev 5357)
@@ -440,7 +440,7 @@
created = lock(ctx, fqn, lockType, createIfNotExists, timeout,
acquireLockOnParent, reverseRemoveCheck, createdNodes, skipNotification);
firstTry = false;
}
- while (createIfNotExists && peekNode(ctx, fqn, false, true, false) ==
null);// keep trying until we have the lock (fixes concurrent remove())
+ while (createIfNotExists && (peekNode(ctx, fqn, false, false, false) ==
null));// keep trying until we have the lock (fixes concurrent remove())
return created;
}
@@ -566,6 +566,7 @@
childName = fqn.get(currentIndex);
currentNode = currentNode.getChildDirect(childName);
+ log.trace("Current node's identity is :" +
System.identityHashCode(currentNode));
}
} while (true);
return created;
Modified:
core/trunk/src/test/java/org/jboss/cache/lock/pessimistic/ConcurrentPutRemoveTest.java
===================================================================
---
core/trunk/src/test/java/org/jboss/cache/lock/pessimistic/ConcurrentPutRemoveTest.java 2008-02-19
19:57:56 UTC (rev 5356)
+++
core/trunk/src/test/java/org/jboss/cache/lock/pessimistic/ConcurrentPutRemoveTest.java 2008-02-19
20:28:55 UTC (rev 5357)
@@ -24,12 +24,13 @@
// The problem is in the way READ_COMMITTED is implemented, i.e., writers are not blocked
by readers and this
// allows a reader to hold a lock when a writer comes in and deletes the node in
question.
-@Test(groups = {"functional"}, enabled = false)
+@Test(groups = {"functional"}, enabled = true)
// Known issue - See JBCACHE-1164 and JBCACHE-1165
public class ConcurrentPutRemoveTest
{
private TransactionManager tm;
+ static int count = 0;
private Cache cache;
private final Log log = LogFactory.getLog(ConcurrentPutRemoveTest.class);
@@ -60,9 +61,10 @@
}
}
- @Test(invocationCount = 25, enabled = false)
+ @Test(invocationCount = 500, enabled = true)
public void testLock() throws Exception
{
+ System.out.println("ConcurrentPutRemoveTest.testLock count = " +
(++count));
for (int x = 0; x < 2; x++)
{
SeparateThread t = new SeparateThread(x);