[jbosscache-commits] JBoss Cache SVN: r4845 - core/tags/1.4.1.SP8/tests/functional/org/jboss/cache/lock/pessimistic.
jbosscache-commits at lists.jboss.org
jbosscache-commits at lists.jboss.org
Wed Dec 12 16:28:20 EST 2007
Author: manik.surtani at jboss.com
Date: 2007-12-12 16:28:20 -0500 (Wed, 12 Dec 2007)
New Revision: 4845
Removed:
core/tags/1.4.1.SP8/tests/functional/org/jboss/cache/lock/pessimistic/ConcurrentPutRemoveTest.java
Log:
Reverting
Deleted: core/tags/1.4.1.SP8/tests/functional/org/jboss/cache/lock/pessimistic/ConcurrentPutRemoveTest.java
===================================================================
--- core/tags/1.4.1.SP8/tests/functional/org/jboss/cache/lock/pessimistic/ConcurrentPutRemoveTest.java 2007-12-12 15:29:35 UTC (rev 4844)
+++ core/tags/1.4.1.SP8/tests/functional/org/jboss/cache/lock/pessimistic/ConcurrentPutRemoveTest.java 2007-12-12 21:28:20 UTC (rev 4845)
@@ -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