[jboss-cvs] JBossCache/tests/functional/org/jboss/cache/optimistic ...
Manik Surtani
manik at jboss.org
Thu Apr 26 09:19:31 EDT 2007
User: msurtani
Date: 07/04/26 09:19:31
Modified: tests/functional/org/jboss/cache/optimistic CacheTest.java
Log:
added a latch to orchestrate concurrent puts when testing for implicit failures
Revision Changes Path
1.32 +4 -0 JBossCache/tests/functional/org/jboss/cache/optimistic/CacheTest.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: CacheTest.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/optimistic/CacheTest.java,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -b -r1.31 -r1.32
--- CacheTest.java 12 Mar 2007 19:06:43 -0000 1.31
+++ CacheTest.java 26 Apr 2007 13:19:31 -0000 1.32
@@ -23,6 +23,7 @@
import javax.transaction.Transaction;
import javax.transaction.TransactionManager;
import java.util.List;
+import java.util.concurrent.CountDownLatch;
public class CacheTest extends AbstractOptimisticTestCase
{
@@ -73,6 +74,7 @@
// implicit (much harder to orchestrate...
int numThreads = 50;
ExceptionThread thread[] = new ExceptionThread[numThreads];
+ final CountDownLatch latch = new CountDownLatch(1);
for (int i = 0; i < numThreads; i++)
{
@@ -82,6 +84,7 @@
{
try
{
+ latch.await();
c.put("/a", "k", "v");
}
catch (Exception e)
@@ -94,6 +97,7 @@
}
for (int i = 0; i < numThreads; i++) thread[i].start();
+ latch.countDown();
for (int i = 0; i < numThreads; i++) thread[i].join();
// test exceptions.
for (int i = 0; i < numThreads; i++)
More information about the jboss-cvs-commits
mailing list