[jbosscache-commits] JBoss Cache SVN: r4536 - in core/trunk/src/test/java/org/jboss/cache: api and 11 other directories.

jbosscache-commits at lists.jboss.org jbosscache-commits at lists.jboss.org
Wed Oct 3 20:23:11 EDT 2007


Author: jason.greene at jboss.com
Date: 2007-10-03 20:23:11 -0400 (Wed, 03 Oct 2007)
New Revision: 4536

Modified:
   core/trunk/src/test/java/org/jboss/cache/CallbackTest.java
   core/trunk/src/test/java/org/jboss/cache/LifeCycleTest.java
   core/trunk/src/test/java/org/jboss/cache/api/SyncReplTxTest.java
   core/trunk/src/test/java/org/jboss/cache/jmx/CacheJmxWrapperTest.java
   core/trunk/src/test/java/org/jboss/cache/loader/CacheLoaderTestsBase.java
   core/trunk/src/test/java/org/jboss/cache/loader/TxCacheLoaderTest.java
   core/trunk/src/test/java/org/jboss/cache/lock/BreakDeadMemberLocksTest.java
   core/trunk/src/test/java/org/jboss/cache/marshall/AsyncReplTest.java
   core/trunk/src/test/java/org/jboss/cache/marshall/SyncReplTest.java
   core/trunk/src/test/java/org/jboss/cache/notifications/CacheListenerTest.java
   core/trunk/src/test/java/org/jboss/cache/optimistic/ConcurrentTransactionTest.java
   core/trunk/src/test/java/org/jboss/cache/options/ExplicitVersionsReplTest.java
   core/trunk/src/test/java/org/jboss/cache/options/ForceCacheModeTest.java
   core/trunk/src/test/java/org/jboss/cache/options/ForceWriteLockTest.java
   core/trunk/src/test/java/org/jboss/cache/options/LockAcquisitionTimeoutTest.java
   core/trunk/src/test/java/org/jboss/cache/passivation/PassivationTestsBase.java
   core/trunk/src/test/java/org/jboss/cache/replicated/ReplicationExceptionTest.java
   core/trunk/src/test/java/org/jboss/cache/replicated/SyncCacheListenerTest.java
   core/trunk/src/test/java/org/jboss/cache/replicated/SyncReplTxTest.java
   core/trunk/src/test/java/org/jboss/cache/statetransfer/ForcedStateTransferTest.java
   core/trunk/src/test/java/org/jboss/cache/transaction/AbortionTest.java
   core/trunk/src/test/java/org/jboss/cache/transaction/DeadlockTest.java
   core/trunk/src/test/java/org/jboss/cache/transaction/IsolationLevelNoneTest.java
   core/trunk/src/test/java/org/jboss/cache/transaction/IsolationLevelReadCommittedNodeCreationRollbackTest.java
   core/trunk/src/test/java/org/jboss/cache/transaction/IsolationLevelReadCommittedTest.java
   core/trunk/src/test/java/org/jboss/cache/transaction/IsolationLevelRepeatableReadTest.java
   core/trunk/src/test/java/org/jboss/cache/transaction/IsolationLevelSerializableTest.java
   core/trunk/src/test/java/org/jboss/cache/transaction/PrepareTxTest.java
   core/trunk/src/test/java/org/jboss/cache/transaction/TransactionTest.java
Log:
Correct JTA usage


Modified: core/trunk/src/test/java/org/jboss/cache/CallbackTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/CallbackTest.java	2007-10-03 21:55:00 UTC (rev 4535)
+++ core/trunk/src/test/java/org/jboss/cache/CallbackTest.java	2007-10-04 00:23:11 UTC (rev 4536)
@@ -26,7 +26,6 @@
 public class CallbackTest
 {
    CacheImpl<Object, Object> cache = null, cache2;
-   Transaction tx = null;
    final Fqn<String> FQN_A = Fqn.fromString("/a");
    final Fqn<String> FQN_B = Fqn.fromString("/b");
    static final String KEY = "key";
@@ -41,11 +40,6 @@
          cache.destroy();
          cache = null;
       }
-      if (tx != null)
-      {
-         tx.commit();
-         tx = null;
-      }
    }
 
    @Test(groups = {"functional"})
@@ -95,9 +89,10 @@
    {
       cache = createCache(Configuration.CacheMode.LOCAL, IsolationLevel.SERIALIZABLE);
       cache.getNotifier().addCacheListener(new PutListener(cache));
-      tx = startTransaction();
+
+      TransactionManager tm = startTransaction();
       cache.put(FQN_A, null);
-      tx.commit();
+      tm.commit();
       assertTrue(cache.exists(FQN_A));
       assertEquals(0, cache.getNumberOfLocksHeld());
    }
@@ -107,15 +102,15 @@
    {
       cache = createCache(Configuration.CacheMode.LOCAL, IsolationLevel.SERIALIZABLE);
       cache.getNotifier().addCacheListener(new ExceptionListener());
-      tx = startTransaction();
+      TransactionManager tm = startTransaction();
       try
       {
          cache.put(FQN_A, null);
-         tx.rollback();
+         tm.rollback();
       }
       catch (RuntimeException ex)
       {
-         tx.rollback();
+         tm.rollback();
       }
       assertFalse(cache.exists(FQN_A));
       assertEquals(0, cache.getNumberOfLocksHeld());
@@ -130,13 +125,13 @@
       return (CacheImpl<Object, Object>) DefaultCacheFactory.getInstance().createCache(c);
    }
 
-   private Transaction startTransaction()
+   private TransactionManager startTransaction()
    {
       TransactionManager mgr = cache.getConfiguration().getRuntimeConfig().getTransactionManager();
       try
       {
          mgr.begin();
-         return mgr.getTransaction();
+         return mgr;
       }
       catch (Throwable t)
       {

Modified: core/trunk/src/test/java/org/jboss/cache/LifeCycleTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/LifeCycleTest.java	2007-10-03 21:55:00 UTC (rev 4535)
+++ core/trunk/src/test/java/org/jboss/cache/LifeCycleTest.java	2007-10-04 00:23:11 UTC (rev 4536)
@@ -94,7 +94,7 @@
    {
       createAndRegisterCache(Configuration.CacheMode.LOCAL, true);
 
-      Transaction tx = beginTransaction();
+      TransactionManager tm = beginTransaction();
 
       c[0].put("/a/b/c", null);
       log.debug("cache locks before restart:\n" + c[0].printLockInfo());
@@ -107,7 +107,7 @@
       //assertEquals(4, cache.getNumberOfLocksHeld());
       assertEquals(0, c[0].getNumberOfNodes());
 
-      tx.rollback();
+      tm.rollback();
       assertEquals(0, c[0].getNumberOfLocksHeld());
    }
 
@@ -440,11 +440,11 @@
    }
 
 
-   private Transaction beginTransaction() throws SystemException, NotSupportedException
+   private TransactionManager beginTransaction() throws SystemException, NotSupportedException
    {
       TransactionManager mgr = c[0].getConfiguration().getRuntimeConfig().getTransactionManager();
       mgr.begin();
-      return mgr.getTransaction();
+      return mgr;
    }
 
 

Modified: core/trunk/src/test/java/org/jboss/cache/api/SyncReplTxTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/api/SyncReplTxTest.java	2007-10-03 21:55:00 UTC (rev 4535)
+++ core/trunk/src/test/java/org/jboss/cache/api/SyncReplTxTest.java	2007-10-04 00:23:11 UTC (rev 4536)
@@ -75,7 +75,7 @@
                      try
                      {
                         if (t.getStatus() == Status.STATUS_ACTIVE)
-                           t.rollback();
+                           c.getTransactionManager().rollback();
                      }
                      catch (SystemException e)
                      {
@@ -95,11 +95,11 @@
       System.out.println("*** Finished tearDown()");
    }
 
-   private Transaction beginTransaction(Cache<Object, Object> cache) throws NotSupportedException, SystemException
+   private TransactionManager beginTransaction(Cache<Object, Object> cache) throws NotSupportedException, SystemException
    {
       TransactionManager mgr = cache.getConfiguration().getRuntimeConfig().getTransactionManager();
       mgr.begin();
-      return mgr.getTransaction();
+      return mgr;
    }
 
    public void testBasicOperation() throws SystemException, NotSupportedException, HeuristicMixedException, HeuristicRollbackException, RollbackException
@@ -117,11 +117,11 @@
 
       assertNotNull("Should not be null", node);
 
-      Transaction tx = beginTransaction(caches.get(0));
+      TransactionManager tm = beginTransaction(caches.get(0));
       node.put(k, v);
       Transaction tx1 = caches.get(0).getInvocationContext().getTransaction();
       assertNotNull("Transaction can't be null ", tx1);
-      tx.commit();
+      tm.commit();
 
       assertEquals(v, node.get(k));
       assertEquals(v, caches.get(0).get(f, k));

Modified: core/trunk/src/test/java/org/jboss/cache/jmx/CacheJmxWrapperTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/jmx/CacheJmxWrapperTest.java	2007-10-03 21:55:00 UTC (rev 4535)
+++ core/trunk/src/test/java/org/jboss/cache/jmx/CacheJmxWrapperTest.java	2007-10-04 00:23:11 UTC (rev 4536)
@@ -394,7 +394,6 @@
       TransactionManager tm = config.getRuntimeConfig().getTransactionManager();
 
       tm.begin();
-      Transaction tx = tm.getTransaction();
       try
       {
          Fqn fqn = Fqn.fromString("/testing/jmx");
@@ -409,12 +408,12 @@
       }
       catch (Exception e)
       {
-         tx.setRollbackOnly();
+         tm.setRollbackOnly();
          throw e;
       }
       finally
       {
-         tx.commit();
+         tm.commit();
       }
 
    }

Modified: core/trunk/src/test/java/org/jboss/cache/loader/CacheLoaderTestsBase.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/loader/CacheLoaderTestsBase.java	2007-10-03 21:55:00 UTC (rev 4535)
+++ core/trunk/src/test/java/org/jboss/cache/loader/CacheLoaderTestsBase.java	2007-10-04 00:23:11 UTC (rev 4536)
@@ -54,7 +54,6 @@
    private static final Log log = LogFactory.getLog(CacheLoaderTestsBase.class);
    CacheImpl<Object, Object> cache;
    CacheLoader loader = null;
-   private Transaction tx = null;
    static final Fqn<String> FQN = new Fqn<String>("key");
    private static final Fqn<String> SUBTREE_FQN = new Fqn<String>(FQN, "subtree");
 
@@ -82,17 +81,6 @@
    @AfterMethod(alwaysRun = true)
    public void tearDown() throws Exception
    {
-      if (tx != null)
-      {
-         try
-         {
-            tx.commit();
-         }
-         catch (Throwable e)
-         {
-            e.printStackTrace();
-         }
-      }
       cleanup();
       try
       {
@@ -1055,7 +1043,6 @@
       TransactionManager mgr = getTransactionManager();
 
       mgr.begin();
-      tx = mgr.getTransaction();
       Set children = cache.getChildrenNames("/a");
 
       System.out.println("**** " + cache.getTransactionManager());
@@ -1068,7 +1055,7 @@
       System.out.println("lock info " + cache.printLockInfo());
 
       assertEquals(5, cache.getNumberOfLocksHeld());
-      tx.commit();
+      mgr.commit();
 
    }
 
@@ -1077,14 +1064,13 @@
    {
       TransactionManager mgr = getTransactionManager();
       mgr.begin();
-      tx = mgr.getTransaction();
 
       cache.put("/one/two/three", "key1", "val1");
       cache.put("/one/two/three/four", "key2", "val2");
-      tx.commit();
+      mgr.commit();
       assertNotNull("Cache has node /one/two/three", cache.getKeys("/one/two/three"));
       assertNotNull("Loader has node /one/two/three", loader.get(Fqn.fromString("/one/two/three")));
-      Set children = cache.getChildrenNames("/one");
+      Set<?> children = cache.getChildrenNames("/one");
       assertEquals("Cache has correct number of children", 1, children.size());
       children = loader.getChildrenNames(Fqn.fromString("/one"));
       assertEquals("Loader has correct number of children", 1, children.size());
@@ -1098,19 +1084,18 @@
       cache.remove("/one");
       addDelay();
       mgr.begin();
-      tx = mgr.getTransaction();
 
       cache.put("/one/two/three", "key1", "val1");
       cache.put("/one/two/three/four", "key2", "val2");
       log.debug("NODE1 " + cache.get("/one/two/three").getData());
-      tx.rollback();
+      mgr.rollback();
       log.debug("NODE2 " + cache.get("/one/two/three"));
       assertEquals(null, cache.get("/one/two/three", "key1"));
       assertEquals(null, cache.get("/one/two/three/four", "key2"));
       addDelay();
       assertNull("Loader does not have node /one/two/three", loader.get(Fqn.fromString("/one/two/three")));
       assertEquals("Cache does not have node /one/two/three", null, cache.getKeys("/one/two/three"));
-      Set children = cache.getChildrenNames("/one");
+      Set<?> children = cache.getChildrenNames("/one");
       assertEquals("Cache has no children under /one", 0, children.size());
       children = loader.getChildrenNames(Fqn.fromString("/one"));
       assertEquals("Loader has no children under /one", null, children);
@@ -1136,9 +1121,8 @@
 
       TransactionManager mgr = getTransactionManager();
       mgr.begin();
-      tx = mgr.getTransaction();
       doTestBasicOperations();
-      tx.commit();
+      mgr.commit();
    }
 
    /**
@@ -1523,9 +1507,8 @@
 
       TransactionManager mgr = getTransactionManager();
       mgr.begin();
-      tx = mgr.getTransaction();
       doTestModifications();
-      tx.commit();
+      mgr.commit();
    }
 
    /**
@@ -1596,13 +1579,14 @@
       // Object txnKey = new Object();
       TransactionManager mgr = getTransactionManager();
       mgr.begin();
-      tx = mgr.getTransaction();
+      Transaction tx = mgr.getTransaction();
 
       List<Modification> mods = createUpdates();
       loader.prepare(tx, mods, false);
       loader.commit(tx);
       addDelay();
       checkModifications(mods);
+      mgr.commit();
    }
 
    /**

Modified: core/trunk/src/test/java/org/jboss/cache/loader/TxCacheLoaderTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/loader/TxCacheLoaderTest.java	2007-10-03 21:55:00 UTC (rev 4535)
+++ core/trunk/src/test/java/org/jboss/cache/loader/TxCacheLoaderTest.java	2007-10-04 00:23:11 UTC (rev 4536)
@@ -80,14 +80,13 @@
    {
       TransactionManager mgr = cache1.getConfiguration().getRuntimeConfig().getTransactionManager();
       mgr.begin();
-      Transaction tx = mgr.getTransaction();
 
 
       cache1.put(fqn, "key1", "val1");
       cache1.put("/one/two/three/four", "key2", "val2");
       assertNull(cache2.get(fqn, "key1"));
       assertNull(cache2.get("/one/two/three/four", "key2"));
-      tx.commit();
+      mgr.commit();
       assertNotNull(cache1.getKeys(fqn));
       Set<?> children = cache1.getChildrenNames("/one");
       assertEquals(1, children.size());
@@ -101,7 +100,6 @@
    {
       final TransactionManager mgr = cache1.getConfiguration().getRuntimeConfig().getTransactionManager();
       mgr.begin();
-      Transaction tx1 = mgr.getTransaction();
 
       cache1.getConfiguration().setLockAcquisitionTimeout(1500);
       cache2.getConfiguration().setLockAcquisitionTimeout(1500);
@@ -130,7 +128,7 @@
                {
                   try
                   {
-                     tx2.rollback();
+                     mgr.rollback();
                   }
                   catch (SystemException e)
                   {
@@ -149,7 +147,7 @@
 
       try
       {
-         tx1.commit();// prepare() on cache2 will fail due to lock held by locker thread
+         mgr.commit();// prepare() on cache2 will fail due to lock held by locker thread
          fail("commit() should fail because we cannot acquire the lock on cache2");
       }
       catch (RollbackException rollback)
@@ -168,11 +166,10 @@
    {
       TransactionManager mgr = cache1.getConfiguration().getRuntimeConfig().getTransactionManager();
       mgr.begin();
-      Transaction tx = mgr.getTransaction();
 
       cache1.put(fqn, "key1", "val1");
       assertTrue(cache1.exists(fqn));
-      tx.commit();
+      mgr.commit();
       assertTrue(cache1.exists(fqn));
       cache1.put("/a/b/c", null);// should be run outside a TX !
       assertTrue(cache1.exists("/a/b/c"));
@@ -182,11 +179,10 @@
    {
       TransactionManager mgr = cache1.getConfiguration().getRuntimeConfig().getTransactionManager();
       mgr.begin();
-      Transaction tx = mgr.getTransaction();
 
       cache1.put(fqn, "key1", "val1");
       assertTrue(cache1.exists(fqn));
-      tx.rollback();
+      mgr.rollback();
       assertFalse(cache1.getCacheLoader().exists(fqn));
       assertFalse(cache1.exists(fqn));
       cache1.put("/a/b/c", null);// should be run outside a TX !

Modified: core/trunk/src/test/java/org/jboss/cache/lock/BreakDeadMemberLocksTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/lock/BreakDeadMemberLocksTest.java	2007-10-03 21:55:00 UTC (rev 4535)
+++ core/trunk/src/test/java/org/jboss/cache/lock/BreakDeadMemberLocksTest.java	2007-10-04 00:23:11 UTC (rev 4536)
@@ -97,7 +97,7 @@
             try
             {
                tm.resume(tx);
-               tx.commit();
+               tm.commit();
             }
             catch (Exception e) {}
          }

Modified: core/trunk/src/test/java/org/jboss/cache/marshall/AsyncReplTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/marshall/AsyncReplTest.java	2007-10-03 21:55:00 UTC (rev 4535)
+++ core/trunk/src/test/java/org/jboss/cache/marshall/AsyncReplTest.java	2007-10-04 00:23:11 UTC (rev 4536)
@@ -15,7 +15,10 @@
 
 import java.lang.reflect.Method;
 
+import javax.transaction.HeuristicMixedException;
+import javax.transaction.HeuristicRollbackException;
 import javax.transaction.NotSupportedException;
+import javax.transaction.RollbackException;
 import javax.transaction.SystemException;
 import javax.transaction.Transaction;
 import javax.transaction.TransactionManager;
@@ -182,10 +185,10 @@
 
    public void testTxPut() throws Exception
    {
-      Transaction tx = beginTransaction();
+      beginTransaction();
       cache1.put(aop, "person", ben_);
       cache1.put(aop, "person1", ben_);
-      tx.commit();
+      commit();
       TestingUtil.sleepThread(1000);
       Person ben2 = (Person) cache2.get(aop, "person");
       assertNotNull("Person from 2nd cache should not be null ", ben2);
@@ -201,9 +204,9 @@
       Region r2 = cache2.getRegion(aop, false) == null ? cache2.getRegion(aop, true) : cache2.getRegion(aop, false);
       r2.registerContextClassLoader(clb);
 
-      Transaction tx = beginTransaction();
+      beginTransaction();
       cache1.put(aop, "person", ben_);
-      tx.commit();
+      commit();
       TestingUtil.sleepThread(1000);
 
       Object ben2 = null;
@@ -264,6 +267,11 @@
       return mgr.getTransaction();
    }
 
+   private void commit() throws SecurityException, IllegalStateException, RollbackException, HeuristicMixedException, HeuristicRollbackException, SystemException
+   {
+      cache1.getConfiguration().getRuntimeConfig().getTransactionManager().commit();
+   }
+
    protected Object getPersonFromClassloader(ClassLoader cl) throws Exception
    {
       Class<?> clazz = cl.loadClass(PERSON_CLASSNAME);

Modified: core/trunk/src/test/java/org/jboss/cache/marshall/SyncReplTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/marshall/SyncReplTest.java	2007-10-03 21:55:00 UTC (rev 4535)
+++ core/trunk/src/test/java/org/jboss/cache/marshall/SyncReplTest.java	2007-10-04 00:23:11 UTC (rev 4536)
@@ -21,6 +21,7 @@
 import javax.transaction.NotSupportedException;
 import javax.transaction.SystemException;
 import javax.transaction.Transaction;
+import javax.transaction.TransactionManager;
 
 import org.jboss.cache.CacheSPI;
 import org.jboss.cache.DefaultCacheFactory;
@@ -295,7 +296,7 @@
       Region r2 = cache2.getRegion(aop, false) == null ? cache2.getRegion(aop, true) : cache2.getRegion(aop, false);
       r2.registerContextClassLoader(cl);
 
-      Transaction tx = beginTransaction();
+      TransactionManager tm = beginTransaction();
       cache1.put(Fqn.fromString("/aop/1"), "person", ben_);
       cache1.remove(Fqn.fromString("/aop/1"), "person");
       HashMap<Object, Object> map = new HashMap<Object, Object>();
@@ -303,19 +304,19 @@
       map.put("2", "2");
       cache1.put(Fqn.fromString("/aop/2"), map);
       cache1.removeNode(Fqn.fromString("/aop/2"));
-      tx.commit();
+      tm.commit();
 
       TestingUtil.sleepThread(1000);
    }
 
    public void testTxPut() throws Exception
    {
-      Transaction tx = beginTransaction();
+      TransactionManager tm = beginTransaction();
       cache1.put(aop, "person", ben_);
       cache1.put(aop, "person1", ben_);
       cache1.removeNode(aop);
       cache1.put(aop, "person", ben_);
-      tx.commit();
+      tm.commit();
       Person ben2 = (Person) cache2.get(aop, "person");
       assertNotNull("Person from 2nd cache should not be null ", ben2);
       assertEquals(ben_.toString(), ben2.toString());
@@ -323,10 +324,10 @@
 
    public void testTxRollback() throws Exception
    {
-      Transaction tx = beginTransaction();
+      TransactionManager tm = beginTransaction();
       cache1.put(aop, "person", ben_);
       cache1.put(aop, "person1", ben_);
-      tx.rollback();
+      tm.rollback();
       Person ben2 = (Person) cache2.get(aop, "person");
       assertNull("Person from 2nd cache should be null ", ben2);
    }
@@ -340,9 +341,9 @@
       Region r2 = cache2.getRegion(aop, false) == null ? cache2.getRegion(aop, true) : cache2.getRegion(aop, false);
       r2.registerContextClassLoader(clb);
 
-      Transaction tx = beginTransaction();
+      TransactionManager tm = beginTransaction();
       cache1.put(aop, "person", ben_);
-      tx.commit();
+      tm.commit();
 
       Object ben2;
       // Can't cast it to Person. CCE will resutl.
@@ -407,11 +408,11 @@
       }
    }
 
-   private Transaction beginTransaction() throws SystemException, NotSupportedException
+   private TransactionManager beginTransaction() throws SystemException, NotSupportedException
    {
-      DummyTransactionManager mgr = DummyTransactionManager.getInstance();
+      TransactionManager mgr = cache1.getConfiguration().getRuntimeConfig().getTransactionManager();
       mgr.begin();
-      return mgr.getTransaction();
+      return mgr;
    }
 
    protected Object getPersonFromClassloader(ClassLoader cl) throws Exception

Modified: core/trunk/src/test/java/org/jboss/cache/notifications/CacheListenerTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/notifications/CacheListenerTest.java	2007-10-03 21:55:00 UTC (rev 4535)
+++ core/trunk/src/test/java/org/jboss/cache/notifications/CacheListenerTest.java	2007-10-04 00:23:11 UTC (rev 4536)
@@ -77,7 +77,7 @@
    {
       Transaction t = tm.getTransaction();
       if (t != null)
-         t.rollback();
+         tm.rollback();
       cache.stop();
       cache.destroy();
    }

Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/ConcurrentTransactionTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/ConcurrentTransactionTest.java	2007-10-03 21:55:00 UTC (rev 4535)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/ConcurrentTransactionTest.java	2007-10-04 00:23:11 UTC (rev 4536)
@@ -92,7 +92,7 @@
       assertEquals(value, cache.get(abcg, key));
 
       tm.resume(tx);
-      tx.commit();
+      tm.commit();
 
       assertEquals(value, cache.get(abxy, key));
 

Modified: core/trunk/src/test/java/org/jboss/cache/options/ExplicitVersionsReplTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/options/ExplicitVersionsReplTest.java	2007-10-03 21:55:00 UTC (rev 4535)
+++ core/trunk/src/test/java/org/jboss/cache/options/ExplicitVersionsReplTest.java	2007-10-04 00:23:11 UTC (rev 4536)
@@ -79,7 +79,7 @@
       try
       {
          if (tm != null && tm.getTransaction() != null)
-            tm.getTransaction().rollback();
+            tm.rollback();
       }
       catch (Exception e)
       {

Modified: core/trunk/src/test/java/org/jboss/cache/options/ForceCacheModeTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/options/ForceCacheModeTest.java	2007-10-03 21:55:00 UTC (rev 4535)
+++ core/trunk/src/test/java/org/jboss/cache/options/ForceCacheModeTest.java	2007-10-04 00:23:11 UTC (rev 4536)
@@ -41,19 +41,19 @@
 /**
  * Tests functionality of {@link Option#setForceAsynchronous(boolean)} and
  * {@link Option#setForceSynchronous(boolean)}.
- * 
+ *
  * @author <a href="mailto:manik at jboss.org">Manik Surtani (manik at jboss.org)</a>
  */
 @Test(groups = {"functional"})
 public class ForceCacheModeTest
 {
    private static final Log log = LogFactory.getLog(ForceCacheModeTest.class);
-   
+
    private static final Fqn FQNA = Fqn.fromString("/A");
    private static final String KEY = "key";
    private static final String VALUE1 = "value1";
    private static final String VALUE2 = "value2";
-   
+
    private CacheImpl<Object, Object> cache1, cache2;
    private Option asyncOption;
    private Option syncOption;
@@ -84,20 +84,20 @@
 
       syncOption = new Option();
       syncOption.setForceSynchronous(true);
-      
+
       Option local = new Option();
       local.setCacheModeLocal(true);
-      
+
       cache1.getInvocationContext().setOptionOverrides(local);
       cache1.put(FQNA, KEY, VALUE1);
-      
+
       cache2.getInvocationContext().setOptionOverrides(local);
       cache2.put(FQNA, KEY, VALUE1);
-      
+
       listener = new BlockingListener();
       cache2.addCacheListener(listener);
    }
-   
+
    @BeforeMethod(alwaysRun = true)
    public void setUp() throws Exception
    {
@@ -122,182 +122,182 @@
          cache2.destroy();
          cache2 = null;
       }
-      
+
       latch.countDown();
    }
-   
+
    public void testPessimisticReplicationPutForceAsync() throws Exception
    {
       createCaches(NodeLockingScheme.PESSIMISTIC, CacheMode.REPL_SYNC);
-      
-      checkNoBlocking(null, asyncOption, false);      
+
+      checkNoBlocking(null, asyncOption, false);
    }
-   
+
    public void testPessimisticReplicationRemoveForceAsync() throws Exception
    {
       createCaches(NodeLockingScheme.PESSIMISTIC, CacheMode.REPL_SYNC);
-      
-      checkNoBlocking(null, asyncOption, true);      
+
+      checkNoBlocking(null, asyncOption, true);
    }
-   
+
    public void testPessimisticReplicationPutForceAsyncWithTx() throws Exception
    {
       createCaches(NodeLockingScheme.PESSIMISTIC, CacheMode.REPL_SYNC);
-      
-      checkBlocking(cache1.getTransactionManager(), asyncOption, false);      
+
+      checkBlocking(cache1.getTransactionManager(), asyncOption, false);
    }
-   
+
    public void testPessimisticInvalidationPutForceAsync() throws Exception
    {
       createCaches(NodeLockingScheme.PESSIMISTIC, CacheMode.INVALIDATION_SYNC);
-      
-      checkNoBlocking(null, asyncOption, false);      
+
+      checkNoBlocking(null, asyncOption, false);
    }
-   
+
    public void testPessimisticInvalidationRemoveForceAsync() throws Exception
    {
       createCaches(NodeLockingScheme.PESSIMISTIC, CacheMode.INVALIDATION_SYNC);
-      
-      checkNoBlocking(null, asyncOption, true);      
+
+      checkNoBlocking(null, asyncOption, true);
    }
-   
+
    public void testPessimisticInvalidationPutForceAsyncWithTx() throws Exception
    {
-      createCaches(NodeLockingScheme.PESSIMISTIC, CacheMode.INVALIDATION_SYNC); 
-      
-      checkBlocking(cache1.getTransactionManager(), asyncOption, false);           
+      createCaches(NodeLockingScheme.PESSIMISTIC, CacheMode.INVALIDATION_SYNC);
+
+      checkBlocking(cache1.getTransactionManager(), asyncOption, false);
    }
-   
+
    public void testPessimisticReplicationPutForceSync() throws Exception
    {
       createCaches(NodeLockingScheme.PESSIMISTIC, CacheMode.REPL_ASYNC);
-      
-      checkBlocking(null, syncOption, false);      
+
+      checkBlocking(null, syncOption, false);
    }
-   
+
    public void testPessimisticReplicationRemoveForceSync() throws Exception
    {
       createCaches(NodeLockingScheme.PESSIMISTIC, CacheMode.REPL_ASYNC);
-      
-      checkBlocking(null, syncOption, true);      
+
+      checkBlocking(null, syncOption, true);
    }
-   
+
    public void testPessimisticReplicationPutForceSyncWithTx() throws Exception
    {
       createCaches(NodeLockingScheme.PESSIMISTIC, CacheMode.REPL_ASYNC);
-      
-      checkNoBlocking(cache1.getTransactionManager(), syncOption, false);      
+
+      checkNoBlocking(cache1.getTransactionManager(), syncOption, false);
    }
-   
+
    public void testPessimisticInvalidationPutForceSync() throws Exception
    {
       createCaches(NodeLockingScheme.PESSIMISTIC, CacheMode.INVALIDATION_ASYNC);
-      
-      checkBlocking(null, syncOption, false);            
+
+      checkBlocking(null, syncOption, false);
    }
-   
+
    public void testPessimisticInvalidationRemoveForceSync() throws Exception
    {
       createCaches(NodeLockingScheme.PESSIMISTIC, CacheMode.INVALIDATION_ASYNC);
-      
-      checkBlocking(null, syncOption, true);            
+
+      checkBlocking(null, syncOption, true);
    }
-   
+
    public void testPessimisticInvalidationPutForceSyncWithTx() throws Exception
    {
-      createCaches(NodeLockingScheme.PESSIMISTIC, CacheMode.INVALIDATION_ASYNC); 
-      
-      checkNoBlocking(cache1.getTransactionManager(), syncOption, false);           
+      createCaches(NodeLockingScheme.PESSIMISTIC, CacheMode.INVALIDATION_ASYNC);
+
+      checkNoBlocking(cache1.getTransactionManager(), syncOption, false);
    }
-   
+
    public void testOptimisticReplicationPutForceAsync() throws Exception
    {
-      createCaches(NodeLockingScheme.OPTIMISTIC, CacheMode.REPL_SYNC); 
-      
-      checkNoBlocking(null, asyncOption, false);           
+      createCaches(NodeLockingScheme.OPTIMISTIC, CacheMode.REPL_SYNC);
+
+      checkNoBlocking(null, asyncOption, false);
    }
-   
+
    public void testOptimisticReplicationRemoveForceAsync() throws Exception
    {
-      createCaches(NodeLockingScheme.OPTIMISTIC, CacheMode.REPL_SYNC); 
-      
-      checkNoBlocking(null, asyncOption, true);           
+      createCaches(NodeLockingScheme.OPTIMISTIC, CacheMode.REPL_SYNC);
+
+      checkNoBlocking(null, asyncOption, true);
    }
-   
+
    public void testOptimisticReplicationPutForceAsyncWithTx() throws Exception
    {
-      createCaches(NodeLockingScheme.OPTIMISTIC, CacheMode.REPL_SYNC);  
-      
-      checkBlocking(cache1.getTransactionManager(), asyncOption, false);          
+      createCaches(NodeLockingScheme.OPTIMISTIC, CacheMode.REPL_SYNC);
+
+      checkBlocking(cache1.getTransactionManager(), asyncOption, false);
    }
-   
+
    public void testOptimisticInvalidationPutForceAsync() throws Exception
    {
-      createCaches(NodeLockingScheme.OPTIMISTIC, CacheMode.INVALIDATION_SYNC); 
-      
-      checkNoBlocking(null, asyncOption, false);           
+      createCaches(NodeLockingScheme.OPTIMISTIC, CacheMode.INVALIDATION_SYNC);
+
+      checkNoBlocking(null, asyncOption, false);
    }
-   
+
    public void testOptimisticInvalidationRemoveForceAsync() throws Exception
    {
-      createCaches(NodeLockingScheme.OPTIMISTIC, CacheMode.INVALIDATION_SYNC); 
-      
-      checkNoBlocking(null, asyncOption, true);           
+      createCaches(NodeLockingScheme.OPTIMISTIC, CacheMode.INVALIDATION_SYNC);
+
+      checkNoBlocking(null, asyncOption, true);
    }
-   
+
    public void testOptimisticInvalidationPutForceAsyncWithTx() throws Exception
    {
-      createCaches(NodeLockingScheme.OPTIMISTIC, CacheMode.INVALIDATION_SYNC); 
-      
-      checkBlocking(cache1.getTransactionManager(), asyncOption, false);      
+      createCaches(NodeLockingScheme.OPTIMISTIC, CacheMode.INVALIDATION_SYNC);
+
+      checkBlocking(cache1.getTransactionManager(), asyncOption, false);
    }
-   
+
    public void testOptimisticReplicationPutForceSync() throws Exception
    {
       createCaches(NodeLockingScheme.OPTIMISTIC, CacheMode.REPL_ASYNC);
-      
-      checkBlocking(null, syncOption, false);           
+
+      checkBlocking(null, syncOption, false);
    }
-   
+
    public void testOptimisticReplicationRemoveForceSync() throws Exception
    {
       createCaches(NodeLockingScheme.OPTIMISTIC, CacheMode.REPL_ASYNC);
-      
-      checkBlocking(null, syncOption, true);           
+
+      checkBlocking(null, syncOption, true);
    }
-   
+
    public void testOptimisticReplicationPutForceSyncWithTx() throws Exception
    {
-      createCaches(NodeLockingScheme.OPTIMISTIC, CacheMode.REPL_ASYNC);   
-      
-      checkNoBlocking(cache1.getTransactionManager(), syncOption, false);                
+      createCaches(NodeLockingScheme.OPTIMISTIC, CacheMode.REPL_ASYNC);
+
+      checkNoBlocking(cache1.getTransactionManager(), syncOption, false);
    }
-   
+
    public void testOptimisticInvalidationPutForceSync() throws Exception
    {
-      createCaches(NodeLockingScheme.OPTIMISTIC, CacheMode.INVALIDATION_ASYNC); 
-      
-      checkBlocking(null, syncOption, false);                 
+      createCaches(NodeLockingScheme.OPTIMISTIC, CacheMode.INVALIDATION_ASYNC);
+
+      checkBlocking(null, syncOption, false);
    }
-   
+
    public void testOptimisticInvalidationRemoveForceSync() throws Exception
    {
-      createCaches(NodeLockingScheme.OPTIMISTIC, CacheMode.INVALIDATION_ASYNC); 
-      
-      checkBlocking(null, syncOption, true);                 
+      createCaches(NodeLockingScheme.OPTIMISTIC, CacheMode.INVALIDATION_ASYNC);
+
+      checkBlocking(null, syncOption, true);
    }
-   
+
    public void testOptimisticInvalidationPutForceSyncWithTx() throws Exception
    {
-      createCaches(NodeLockingScheme.OPTIMISTIC, CacheMode.INVALIDATION_ASYNC); 
-      
-      checkNoBlocking(cache1.getTransactionManager(), syncOption, false);                 
+      createCaches(NodeLockingScheme.OPTIMISTIC, CacheMode.INVALIDATION_ASYNC);
+
+      checkNoBlocking(cache1.getTransactionManager(), syncOption, false);
    }
 
    /**
     * Confirms the updater is not blocked and that the cache state is as
     * expected at the end.
-    * 
+    *
     * @param tm transction manager Updater should use. For non-transactional
     *           tests, should be <code>null</code>
     * @param option Option to set before doing put
@@ -309,22 +309,22 @@
    {
       Updater updater = new Updater(tm, option, removeTest);
       updater.start();
-      
+
       updater.join(250);
       assertTrue("Updater finished", updater.finished);
-      
+
       for (int i = 0; i < 50; i++)
       {
          if (listener.blocked)
             break;
          TestingUtil.sleepThread(10);
       }
-      
+
       assertTrue("Listener blocked", listener.blocked);
       assertEquals("Cache1 correct", removeTest ? null : VALUE2, cache1.get(FQNA, KEY));
-      
+
       latch.countDown();
-      
+
       for (int i = 0; i < 50; i++)
       {
          if (!listener.blocked)
@@ -332,7 +332,7 @@
          TestingUtil.sleepThread(10);
       }
 
-      // sleep a bit more to ensure the cache2 thread completes 
+      // sleep a bit more to ensure the cache2 thread completes
       TestingUtil.sleepThread(5);
       CacheMode mode = cache2.getConfiguration().getCacheMode();
       boolean expectNull = (removeTest || mode == CacheMode.INVALIDATION_ASYNC || mode == CacheMode.INVALIDATION_SYNC);
@@ -342,7 +342,7 @@
    /**
     * Confirms the updater is blocked and that the cache state is as
     * expected at the end.
-    * 
+    *
     * @param tm transction manager Updater should use. For non-transactional
     *           tests, should be <code>null</code>
     * @param option Option to set before doing put
@@ -354,21 +354,21 @@
    {
       Updater updater = new Updater(tm, option, removeTest);
       updater.start();
-      
+
       updater.join(250);
       assertFalse("Updater blocked", updater.finished);
-      
+
       for (int i = 0; i < 50; i++)
       {
          if (listener.blocked)
             break;
          TestingUtil.sleepThread(10);
       }
-      
+
       assertTrue("Listener blocked", listener.blocked);
-      
+
       latch.countDown();
-      
+
       for (int i = 0; i < 50; i++)
       {
          if (updater.finished && !listener.blocked)
@@ -377,14 +377,14 @@
       }
 
       assertEquals("Cache1 correct", removeTest ? null : VALUE2, cache1.get(FQNA, KEY));
-      
-      // sleep a bit more to ensure the cache2 thread completes 
+
+      // sleep a bit more to ensure the cache2 thread completes
       TestingUtil.sleepThread(5);
       CacheMode mode = cache2.getConfiguration().getCacheMode();
       boolean expectNull = (removeTest || mode == CacheMode.INVALIDATION_ASYNC || mode == CacheMode.INVALIDATION_SYNC);
       assertEquals("Cache2 correct", expectNull ? null : VALUE2, cache2.get(FQNA, KEY));
    }
-   
+
    class Updater extends Thread
    {
       TransactionManager tm;
@@ -392,33 +392,31 @@
       boolean remove;
       Throwable failure;
       boolean finished;
-      
+
       Updater(TransactionManager tm, Option option)
       {
          this(tm, option, false);
       }
-      
+
       Updater(TransactionManager tm, Option option, boolean remove)
       {
          this.tm = tm;
          this.option = option;
          this.remove = remove;
       }
-      
+
       public void run()
       {
          try
          {
-            Transaction tx = null;
-            
+
             try
             {
                if (tm != null)
                {
                   tm.begin();
-                  tx = tm.getTransaction();
                }
-               
+
                cache1.getInvocationContext().setOptionOverrides(option);
                if (remove)
                   cache1.remove(FQNA, KEY);
@@ -427,15 +425,15 @@
             }
             catch (Exception e)
             {
-               if (tx != null)
-                  tx.setRollbackOnly();
+               if (tm != null)
+                  tm.setRollbackOnly();
                throw e;
             }
             finally
             {
-               if (tx != null)
+               if (tm != null)
                {
-                  tx.commit();
+                  tm.commit();
                }
                finished = true;
             }
@@ -446,30 +444,30 @@
          }
       }
    }
-   
+
    @CacheListener
    public static class BlockingListener
    {
       boolean blocked;
-      
+
       @NodeModified
-      public void nodeModified(NodeModifiedEvent event)      
+      public void nodeModified(NodeModifiedEvent event)
       {
-         block(event);         
+         block(event);
       }
-      
+
       @NodeRemoved
-      public void nodeRemoved(NodeRemovedEvent event)      
+      public void nodeRemoved(NodeRemovedEvent event)
       {
-         block(event);         
+         block(event);
       }
-      
+
       @NodeEvicted
-      public void nodeEvicted(NodeEvictedEvent event)      
+      public void nodeEvicted(NodeEvictedEvent event)
       {
-         block(event);         
+         block(event);
       }
-      
+
       private void block(NodeEvent event)
       {
          if (event.isPre() == false && FQNA.equals(event.getFqn()))
@@ -480,10 +478,10 @@
                latch.await();
             }
             catch (InterruptedException e) {}
-            
+
             blocked = false;
          }
       }
    }
-   
+
 }

Modified: core/trunk/src/test/java/org/jboss/cache/options/ForceWriteLockTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/options/ForceWriteLockTest.java	2007-10-03 21:55:00 UTC (rev 4535)
+++ core/trunk/src/test/java/org/jboss/cache/options/ForceWriteLockTest.java	2007-10-04 00:23:11 UTC (rev 4536)
@@ -44,7 +44,7 @@
    {
       try
       {
-         tm.getTransaction().rollback();
+         tm.rollback();
       }
       catch (Exception e)
       {

Modified: core/trunk/src/test/java/org/jboss/cache/options/LockAcquisitionTimeoutTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/options/LockAcquisitionTimeoutTest.java	2007-10-03 21:55:00 UTC (rev 4535)
+++ core/trunk/src/test/java/org/jboss/cache/options/LockAcquisitionTimeoutTest.java	2007-10-04 00:23:11 UTC (rev 4536)
@@ -28,20 +28,20 @@
 
 /**
  * Test functionality of {@link Option#setLockAcquisitionTimeout(int)}.
- * 
+ *
  * @author Brian Stansberry
  */
 @Test(groups = {"functional"})
 public class LockAcquisitionTimeoutTest
 {
    private static final Log log = LogFactory.getLog(LockAcquisitionTimeoutTest.class);
-   
+
    private static final Fqn FQNA = Fqn.fromString("/A");
    private static final Fqn FQNB = Fqn.fromString("/B");
    private static final String KEY = "key";
    private static final String VALUE1 = "value1";
    private static final String VALUE2 = "value2";
-   
+
    private CacheImpl<Object, Object> cache;
    private Option option;
 
@@ -75,7 +75,7 @@
     * does the put as expected. There is no other thread or tx contesting
     * the lock the put needs, so this is just a simple test that the option
     * doesn't somehow screw up the put.
-    * 
+    *
     * @throws Exception
     */
    public void testSimplePut() throws Exception
@@ -83,44 +83,44 @@
       log.info("++++ testSimplePut() ++++");
       simplePutTest(false);
    }
-   
+
    /**
     * Confirms that doing a put with a lockAcquisitionTime option set
-    * does the put as expected when executed within a transaction. There is no 
-    * other thread or tx contesting the lock the put needs, so this is just a 
+    * does the put as expected when executed within a transaction. There is no
+    * other thread or tx contesting the lock the put needs, so this is just a
     * simple test that the option doesn't somehow screw up the put.
-    * 
+    *
     * @throws Exception
     */
    public void testSimplePutWithTx() throws Exception
    {
       log.info("++++ testSimplePutWithTx() ++++");
-      simplePutTest(true);      
+      simplePutTest(true);
    }
-   
+
    private void simplePutTest(boolean useTx) throws Exception
    {
-      TransactionManager tm = useTx ? cache.getTransactionManager() : null;      
+      TransactionManager tm = useTx ? cache.getTransactionManager() : null;
       LowTimeoutSetter setter = new LowTimeoutSetter(tm);
       setter.start();
-      
+
       setter.join(2000);
       if (!setter.finished)
       {
          setter.interrupt();
          fail("Puts failed to complete in a timely manner");
       }
-      
+
       assertNull("LowTimeoutSetter saw no TimeoutException", setter.te);
       assertNull("LowTimeoutSetter saw no misc Exception", setter.failure);
       assertEquals("Cache correct for " + FQNA, VALUE2, cache.get(FQNA, KEY));
       assertEquals("Cache correct for " + FQNB, VALUE2, cache.get(FQNB, KEY));
    }
-   
+
    /**
     * Confirms that a put with a lockAcquisitionTimeout option set to zero
     * fails promptly in the presence of a lock on the target node.
-    * 
+    *
     * @throws Exception
     */
    public void testContestedPut() throws Exception
@@ -128,34 +128,34 @@
       log.info("++++ testContestedPut() ++++");
       contestedPutTest(false);
    }
-   
+
    /**
     * Confirms that a put with a lockAcquisitionTimeout option set to zero
     * is ignored if executed within a transaction.
-    * 
+    *
     * @throws Exception
-    */   
+    */
    public void testContestedPutWithTx() throws Exception
    {
       log.info("++++ testContestedPutWithTx() ++++");
       contestedPutTest(true);
    }
-   
+
    private void contestedPutTest(boolean tx) throws Exception
    {
       TransactionManager mgr = cache.getTransactionManager();
       mgr.begin();
-      
+
       LowTimeoutSetter setter = null;
       try
       {
          // Put a WL on /A
          cache.put(FQNA, KEY, VALUE1);
-         
-         // Launch a thread that tries to write to /A 
+
+         // Launch a thread that tries to write to /A
          setter = new LowTimeoutSetter(tx ? mgr : null);
          setter.start();
-         
+
          setter.join(2000);
          if (!setter.finished)
          {
@@ -168,75 +168,75 @@
          // always commit the tx
          mgr.commit();
       }
-      
+
       assertNotNull("LowTimeoutSetter saw TimeoutException", setter.te);
       assertNull("LowTimeoutSetter saw no misc Exception", setter.failure);
       assertEquals("Cache correct for " + FQNA, VALUE1, cache.get(FQNA, KEY));
       assertEquals("Cache correct for " + FQNB, VALUE2, cache.get(FQNB, KEY));
-      
+
    }
-   
+
    public void testSimpleRead() throws Exception
    {
       log.info("++++++ testSimpleRead() ++++++");
       simpleReadTest(false);
    }
-   
+
    public void testSimpleReadWithTx() throws Exception
    {
       log.info("++++++ testSimpleReadWithTx() ++++++");
       simpleReadTest(true);
    }
-   
+
    private void simpleReadTest(boolean useTx) throws Exception
    {
-      TransactionManager tm = useTx ? cache.getTransactionManager() : null;      
+      TransactionManager tm = useTx ? cache.getTransactionManager() : null;
       LowTimeoutReader reader = new LowTimeoutReader(tm);
-      
+
       cache.put(FQNA, KEY, VALUE1);
-      
+
       reader.start();
-      
+
       reader.join(2000);
       if (!reader.finished)
       {
          reader.interrupt();
          fail("Read failed to complete in a timely manner");
       }
-      
+
       assertNull("LowTimeoutSetter saw no TimeoutException", reader.te);
       assertNull("LowTimeoutSetter saw no misc Exception", reader.failure);
       assertEquals("LowTimeoutSetter correct for " + FQNA, VALUE1, reader.value);
-      
+
    }
-   
+
    public void testContestedRead() throws Exception
    {
       log.info("++++++ testContestedRead() ++++++");
       contestedReadTest(false);
    }
-   
+
    public void testContestedReadWithTx() throws Exception
    {
       log.info("++++++ testContestedReadWithTx() ++++++");
       contestedReadTest(true);
    }
-   
+
    private void contestedReadTest(boolean tx) throws Exception
    {
       TransactionManager mgr = cache.getTransactionManager();
       mgr.begin();
-      
+
       LowTimeoutReader reader = null;
       try
       {
          // Put a WL on /A
          cache.put(FQNA, KEY, VALUE1);
-         
-         // Launch a thread that tries to read from /A 
+
+         // Launch a thread that tries to read from /A
          reader = new LowTimeoutReader(tx ? mgr : null);
          reader.start();
-         
+
          reader.join(2000);
          if (!reader.finished)
          {
@@ -249,41 +249,38 @@
          // always commit the tx
          mgr.commit();
       }
-      
+
       assertNotNull("LowTimeoutSetter saw TimeoutException", reader.te);
       assertNull("LowTimeoutSetter saw no misc Exception", reader.failure);
       assertNull("LowTimeoutSetter unable to read " + FQNA, reader.value);
-      
+
    }
-   
+
    class LowTimeoutSetter extends Thread
    {
       TransactionManager tm;
       TimeoutException te;
       Throwable failure;
       boolean finished;
-      
+
       LowTimeoutSetter(TransactionManager tm)
       {
          this.tm = tm;
       }
-      
+
       public void run()
       {
          try
          {
-            Transaction tx = null;
-            
             try
             {
                if (tm != null)
                {
                   tm.begin();
-                  tx = tm.getTransaction();
                }
-               
+
                cache.put(FQNB, KEY, VALUE2);
-               
+
                cache.getInvocationContext().setOptionOverrides(option);
                cache.put(FQNA, KEY, VALUE2);
             }
@@ -293,15 +290,15 @@
             }
             catch (Exception e)
             {
-               if (tx != null)
-                  tx.setRollbackOnly();
+               if (tm != null)
+                  tm.setRollbackOnly();
                throw e;
             }
             finally
             {
-               if (tx != null)
+               if (tm != null)
                {
-                  tx.commit();
+                  tm.commit();
                }
                finished = true;
             }
@@ -312,7 +309,7 @@
          }
       }
    }
-   
+
    class LowTimeoutReader extends Thread
    {
       TransactionManager tm;
@@ -320,26 +317,23 @@
       Throwable failure;
       Object value;
       boolean finished;
-      
+
       LowTimeoutReader(TransactionManager tm)
       {
          this.tm = tm;
       }
-      
+
       public void run()
       {
          try
          {
-            Transaction tx = null;
-            
             try
             {
                if (tm != null)
                {
                   tm.begin();
-                  tx = tm.getTransaction();
                }
-               
+
                cache.getInvocationContext().setOptionOverrides(option);
                value = cache.get(FQNA, KEY);
             }
@@ -349,15 +343,15 @@
             }
             catch (Exception e)
             {
-               if (tx != null)
-                  tx.setRollbackOnly();
+               if (tm != null)
+                  tm.setRollbackOnly();
                throw e;
             }
             finally
             {
-               if (tx != null)
+               if (tm != null)
                {
-                  tx.commit();
+                  tm.commit();
                }
                finished = true;
             }

Modified: core/trunk/src/test/java/org/jboss/cache/passivation/PassivationTestsBase.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/passivation/PassivationTestsBase.java	2007-10-03 21:55:00 UTC (rev 4535)
+++ core/trunk/src/test/java/org/jboss/cache/passivation/PassivationTestsBase.java	2007-10-04 00:23:11 UTC (rev 4536)
@@ -58,7 +58,6 @@
    //Cache Loader fields
    CacheImpl<Object, Object> cache;
    CacheLoader loader = null;
-   Transaction tx = null;
    static final Fqn<String> FQN = new Fqn<String>("key");
 
 
@@ -97,17 +96,6 @@
 
    @AfterMethod(alwaysRun = true) public void tearDown() throws Exception
    {
-      if (tx != null)
-      {
-         try
-         {
-            tx.commit();
-         }
-         catch (Throwable e)
-         {
-            e.printStackTrace();
-         }
-      }
       cache.remove("/");
       loader.remove(Fqn.fromString("/"));
       cache.stop();
@@ -786,14 +774,14 @@
       addDelay();
       DummyTransactionManager mgr = DummyTransactionManager.getInstance();
       mgr.begin();
-      tx = mgr.getTransaction();
-      Set children = cache.getChildrenNames("/a");
+      mgr.getTransaction();
+      Set<?> children = cache.getChildrenNames("/a");
       assertEquals(3, children.size());
       assertTrue(children.contains("1"));
       assertTrue(children.contains("2"));
       assertTrue(children.contains("3"));
       assertEquals(5, cache.getNumberOfLocksHeld());
-      tx.commit();
+      mgr.commit();
    }
 
 
@@ -802,26 +790,24 @@
 
       DummyTransactionManager mgr = DummyTransactionManager.getInstance();
       mgr.begin();
-      tx = mgr.getTransaction();
 
       cache.put("/one/two/three", "key1", "val1");
       cache.put("/one/two/three/four", "key2", "val2");
 
-      tx.commit();
+      mgr.commit();
 
       assertNotNull(cache.getKeys("/one/two/three"));
       assertEquals("val1", cache.get(Fqn.fromString("/one/two/three"), "key1"));
       mgr.begin();
-      tx = mgr.getTransaction();
 
       cache.evict(Fqn.fromString("/one/two/three"));
       cache.evict(Fqn.fromString("/one/two/three/four"));
 
-      tx.commit();
+      mgr.commit();
       assertTrue(loader.exists(Fqn.fromString("/one/two/three")));
       assertTrue(loader.exists(Fqn.fromString("/one/two/three/four")));
       assertNotNull(cache.getKeys("/one/two/three"));
-      Set children = cache.getChildrenNames("/one");
+      Set<?> children = cache.getChildrenNames("/one");
       assertEquals(1, children.size());
       cache.remove("/");
    }
@@ -834,14 +820,13 @@
       cache.remove("/one");
       addDelay();
       mgr.begin();
-      tx = mgr.getTransaction();
 
       cache.put("/one/two/three", "key1", "val1");
       cache.put("/one/two/three/four", "key2", "val2");
-      tx.rollback();
+      mgr.rollback();
       addDelay();
       assertNull(cache.getKeys("/one/two/three"));
-      Set children = cache.getChildrenNames("/one");
+      Set<?> children = cache.getChildrenNames("/one");
       assertTrue(children.isEmpty());
       assertFalse(loader.exists(Fqn.fromString("/one/two/three")));
       assertFalse(loader.exists(Fqn.fromString("/one/two/three/four")));
@@ -889,9 +874,8 @@
 
       DummyTransactionManager mgr = DummyTransactionManager.getInstance();
       mgr.begin();
-      tx = mgr.getTransaction();
       doTestBasicOperations();
-      tx.commit();
+      mgr.commit();
    }
 
    /**
@@ -1276,9 +1260,8 @@
    {
       DummyTransactionManager mgr = DummyTransactionManager.getInstance();
       mgr.begin();
-      tx = mgr.getTransaction();
       doTestModifications();
-      tx.commit();
+      mgr.commit();
    }
 
    /**

Modified: core/trunk/src/test/java/org/jboss/cache/replicated/ReplicationExceptionTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/replicated/ReplicationExceptionTest.java	2007-10-03 21:55:00 UTC (rev 4535)
+++ core/trunk/src/test/java/org/jboss/cache/replicated/ReplicationExceptionTest.java	2007-10-04 00:23:11 UTC (rev 4536)
@@ -18,6 +18,7 @@
 import javax.transaction.RollbackException;
 import javax.transaction.SystemException;
 import javax.transaction.Transaction;
+import javax.transaction.TransactionManager;
 
 import org.jboss.cache.CacheFactory;
 import org.jboss.cache.CacheImpl;
@@ -62,11 +63,11 @@
       }
    }
 
-   private Transaction beginTransaction() throws SystemException, NotSupportedException
+   private TransactionManager beginTransaction() throws SystemException, NotSupportedException
    {
-      DummyTransactionManager mgr = DummyTransactionManager.getInstance();
+      TransactionManager mgr = cache1.getConfiguration().getRuntimeConfig().getTransactionManager();
       mgr.begin();
-      return mgr.getTransaction();
+      return mgr;
    }
 
    private void initCaches(Configuration.CacheMode caching_mode) throws Exception
@@ -136,15 +137,15 @@
 
    public void testNonSerizlableReplWithTx() throws Exception
    {
-      Transaction tx;
+      TransactionManager tm;
 
       try
       {
          initCaches(Configuration.CacheMode.REPL_SYNC);
 
-         tx = beginTransaction();
+         tm = beginTransaction();
          cache1.put("/a/b/c", "test", new ContainerData());
-         tx.commit();
+         tm.commit();
 
          // We should not come here.
          assertNotNull("NonSerializableData should not be null on cache2", cache2.get("/a/b/c", "test"));

Modified: core/trunk/src/test/java/org/jboss/cache/replicated/SyncCacheListenerTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/replicated/SyncCacheListenerTest.java	2007-10-03 21:55:00 UTC (rev 4535)
+++ core/trunk/src/test/java/org/jboss/cache/replicated/SyncCacheListenerTest.java	2007-10-04 00:23:11 UTC (rev 4536)
@@ -21,6 +21,7 @@
 import javax.transaction.NotSupportedException;
 import javax.transaction.SystemException;
 import javax.transaction.Transaction;
+import javax.transaction.TransactionManager;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -76,13 +77,6 @@
       System.out.println("*** finished tearDown()");
    }
 
-   private Transaction beginTransaction() throws SystemException, NotSupportedException
-   {
-      DummyTransactionManager mgr = DummyTransactionManager.getInstance();
-      mgr.begin();
-      return mgr.getTransaction();
-   }
-
    private void initCaches() throws Exception
    {
       cache1 = (CacheImpl<Object, Object>)DefaultCacheFactory.getInstance().createCache(false);
@@ -119,16 +113,18 @@
    public void testSyncTxRepl() throws Exception
    {
       Integer age;
-      Transaction tx;
+      TransactionManager tm = cache1.getTransactionManager();
 
-      tx = beginTransaction();
+      tm.begin();
+      Transaction tx = tm.getTransaction();
       Listener lis = new Listener();
       cache1.getNotifier().addCacheListener(lis);
       lis.put("/a/b/c", "age", 38);
-      cache1.getTransactionManager().suspend();
+
+      tm.suspend();
       assertNull("age on cache2 must be null as the TX has not yet been committed", cache2.get("/a/b/c", "age"));
-      cache1.getTransactionManager().resume(tx);
-      tx.commit();
+      tm.resume(tx);
+      tm.commit();
 
       // value on cache2 must be 38
       age = (Integer)cache2.get("/a/b/c", "age");
@@ -166,19 +162,19 @@
    public void testSyncTxReplMap() throws Exception
    {
       Integer age;
-      Transaction tx;
-
-      tx = beginTransaction();
+      TransactionManager tm = cache1.getConfiguration().getRuntimeConfig().getTransactionManager();
+      tm.begin();
+      Transaction tx = tm.getTransaction();
       Listener lis = new Listener();
       cache1.getNotifier().addCacheListener(lis);
       Map<String, Comparable> map = new HashMap<String, Comparable>();
       map.put("age", 38);
       map.put("name", "Ben");
       lis.put("/a/b/c", map);
-      cache1.getTransactionManager().suspend();
+      tm.suspend();
       assertNull("age on cache2 must be null as the TX has not yet been committed", cache2.get("/a/b/c", "age"));
-      cache1.getTransactionManager().resume(tx);
-      tx.commit();
+      tm.resume(tx);
+      tm.commit();
 
       // value on cache2 must be 38
       age = (Integer)cache2.get("/a/b/c", "age");

Modified: core/trunk/src/test/java/org/jboss/cache/replicated/SyncReplTxTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/replicated/SyncReplTxTest.java	2007-10-03 21:55:00 UTC (rev 4535)
+++ core/trunk/src/test/java/org/jboss/cache/replicated/SyncReplTxTest.java	2007-10-04 00:23:11 UTC (rev 4536)
@@ -78,11 +78,11 @@
       destroyCaches();
    }
 
-   private Transaction beginTransaction() throws SystemException, NotSupportedException
+   private TransactionManager beginTransaction() throws SystemException, NotSupportedException
    {
       TransactionManager mgr = cache1.getConfiguration().getRuntimeConfig().getTransactionManager();
       mgr.begin();
-      return mgr.getTransaction();
+      return mgr;
    }
 
    private void initCaches(Configuration.CacheMode caching_mode) throws Exception
@@ -152,11 +152,11 @@
       initCaches(Configuration.CacheMode.REPL_SYNC);
       cache1.getConfiguration().setSyncCommitPhase(true);
       cache1.releaseAllLocks("/");
-      Transaction tx = beginTransaction();
+      TransactionManager tm = beginTransaction();
       cache1.put("/bela/ban", "name", "Bela Ban");
       assertEquals(3, cache1.getNumberOfLocksHeld());
       assertEquals(0, cache2.getNumberOfLocksHeld());
-      tx.commit();
+      tm.commit();
       assertEquals(0, cache1.getNumberOfLocksHeld());
       assertEquals(0, cache2.getNumberOfLocksHeld());
    }
@@ -174,15 +174,14 @@
 
          // assertEquals(2, cache1.getMembers().size());
 
-         tx = beginTransaction();
+         TransactionManager mgr = beginTransaction();
          cache1.put("/a/b/c", "age", 38);
-         TransactionManager mgr = cache1.getTransactionManager();
          tx = mgr.suspend();
          assertNull("age on cache2 must be null as the TX has not yet been committed", cache2.get("/a/b/c", "age"));
          log.debug("cache1: locks held before commit: " + cache1.printLockInfo());
          log.debug("cache2: locks held before commit: " + cache2.printLockInfo());
          mgr.resume(tx);
-         tx.commit();
+         mgr.commit();
          log.debug("cache1: locks held after commit: " + cache1.printLockInfo());
          log.debug("cache2: locks held after commit: " + cache2.printLockInfo());
 
@@ -211,14 +210,14 @@
 
    public void testSimpleTxPut() throws Exception
    {
-      Transaction tx;
+      TransactionManager tm;
       final Fqn NODE1 = Fqn.fromString("/one/two/three");
       initCaches(Configuration.CacheMode.REPL_SYNC);
 
-      tx = beginTransaction();
+      tm = beginTransaction();
       cache1.put(NODE1, "age", 38);
       System.out.println("TransactionTable for cache1 after cache1.put():\n" + cache1.getTransactionTable().toString(true));
-      tx.commit();
+      tm.commit();
 
       /*
        tx=beginTransaction();
@@ -243,7 +242,7 @@
 
    public void testSyncReplWithModficationsOnBothCaches() throws Exception
    {
-      Transaction tx;
+      TransactionManager tm;
       final Fqn NODE1 = Fqn.fromString("/one/two/three");
       final Fqn NODE2 = Fqn.fromString("/eins/zwei/drei");
 
@@ -256,7 +255,7 @@
       cache1.getConfiguration().setSyncCommitPhase(true);
       cache2.getConfiguration().setSyncCommitPhase(true);
 
-      tx = beginTransaction();
+      tm = beginTransaction();
       cache1.put(NODE1, "age", 38);
       System.out.println("TransactionTable for cache1 after cache1.put():\n" + cache1.getTransactionTable().toString(true));
 
@@ -268,7 +267,7 @@
 
       try
       {
-         tx.commit();
+         tm.commit();
          fail("Should not succeed with SERIALIZABLE semantics");
       }
       catch (Exception e)
@@ -310,10 +309,10 @@
 
    public void testSyncReplWithModficationsOnBothCachesSameData() throws Exception
    {
-      Transaction tx;
+      TransactionManager tm;
       final Fqn NODE = Fqn.fromString("/one/two/three");
       initCaches(Configuration.CacheMode.REPL_SYNC);
-      tx = beginTransaction();
+      tm = beginTransaction();
       cache1.put(NODE, "age", 38);
       System.out.println("TransactionTable for cache1 after cache1.put():\n" + cache1.getTransactionTable().toString(true));
 
@@ -325,7 +324,7 @@
 
       try
       {
-         tx.commit();
+         tm.commit();
          fail("commit should throw a RollbackException, we should not get here");
       }
       catch (RollbackException rollback)
@@ -345,7 +344,7 @@
 
    public void testSyncReplWithModficationsOnBothCachesWithRollback() throws Exception
    {
-      Transaction tx;
+      TransactionManager tm;
       final Fqn NODE1 = Fqn.fromString("/one/two/three");
       final Fqn NODE2 = Fqn.fromString("/eins/zwei/drei");
 
@@ -354,7 +353,7 @@
       cache1.getConfiguration().setSyncRollbackPhase(true);
       cache2.getConfiguration().setSyncRollbackPhase(true);
 
-      tx = beginTransaction();
+      tm = beginTransaction();
       cache1.put(NODE1, "age", 38);
       cache2.put(NODE2, "age", 39);
 
@@ -362,11 +361,12 @@
       System.out.println("cache2 (before commit):\n" + cache2.printLockInfo());
 
       // this will rollback the transaction
+      Transaction tx = tm.getTransaction();
       tx.registerSynchronization(new TransactionAborter(tx));
 
       try
       {
-         tx.commit();
+         tm.commit();
          fail("commit should throw a RollbackException, we should not get here");
       }
       catch (RollbackException rollback)
@@ -482,7 +482,7 @@
     */
    public void testSyncReplWithRemoteRollback() throws Exception
    {
-      Transaction tx;
+      TransactionManager tm;
       final Fqn NODE1 = Fqn.fromString("/one/two/three");
 
       initCaches(Configuration.CacheMode.REPL_SYNC);
@@ -495,25 +495,25 @@
       // listener aborts any active tx
       //TransactionAborterListener tal = new TransactionAborterListener(cache2);
 
-      tx = beginTransaction();
+      tm = beginTransaction();
       cache1.put(NODE1, "age", 38);
 
       System.out.println("cache1 (before commit):\n" + cache1.printLockInfo());
       System.out.println("cache2 (before commit):\n" + cache2.printLockInfo());
 
       // instead of a listener lets just get a WL on ROOT on cache2. And hold on to it.
-      tx = cache1.getTransactionManager().suspend();
+      Transaction tx = tm.suspend();
 
-      cache2.getTransactionManager().begin();
+      tm.begin();
       cache2.getRoot().put("x", "y");
       Transaction tx2 = cache2.getTransactionManager().suspend();
 
       System.out.println("cache2 (before commit):\n" + cache2.printLockInfo());
-      cache1.getTransactionManager().resume(tx);
+      tm.resume(tx);
 
       try
       {
-         tx.commit();
+         tm.commit();
          fail("commit should throw a RollbackException, we should not get here");
       }
       catch (RollbackException rollback)
@@ -522,8 +522,8 @@
       }
       finally
       {
-         cache2.getTransactionManager().resume(tx2);
-         tx2.rollback();
+         tm.resume(tx2);
+         tm.rollback();
       }
 
       // Sleep, as the commit call to cache2 is async
@@ -545,15 +545,15 @@
    public void testASyncRepl() throws Exception
    {
       Integer age;
-      Transaction tx;
+      TransactionManager tm;
 
       initCaches(Configuration.CacheMode.REPL_ASYNC);
 
-      tx = beginTransaction();
+      tm = beginTransaction();
       cache1.put("/a/b/c", "age", 38);
       Thread.sleep(1000);
       assertNull("age on cache2 must be null as the TX has not yet been committed", cache2.get("/a/b/c", "age"));
-      tx.commit();
+      tm.commit();
       Thread.sleep(1000);
 
       // value on cache2 must be 38
@@ -605,16 +605,16 @@
       cache1.getConfiguration().setSyncCommitPhase(true);
 
       Thread t1 = new Thread("Thread1") {
-         Transaction tx;
+         TransactionManager tm;
 
          public void run()
          {
             try
             {
-               tx = beginTransaction();
+               tm = beginTransaction();
                cache1.put("/bela/ban", "name", "Bela Ban");
                TestingUtil.sleepThread(2000);// Thread2 will be blocked until we commit
-               tx.commit();
+               tm.commit();
                System.out.println("[Thread1] ** LOCK INFO cache1: " + cache1.printLockInfo());
                System.out.println("[Thread1] ** LOCK INFO cache2: " + cache2.printLockInfo());
             }
@@ -627,20 +627,20 @@
       };
 
       Thread t2 = new Thread("Thread2") {
-         Transaction tx;
+         TransactionManager tm;
 
          public void run()
          {
             try
             {
                TestingUtil.sleepThread(1000);// give Thread1 time to acquire the lock
-               tx = beginTransaction();
+               tm = beginTransaction();
                System.out.println("[Thread2] ** LOCK INFO cache1: " + cache1.printLockInfo());
                System.out.println("[Thread2] ** LOCK INFO cache2: " + cache2.printLockInfo());
                cache1.put("/bela/ban", "name", "Michelle Ban");
                System.out.println("[Thread2] ** LOCK INFO cache1: " + cache1.printLockInfo());
                System.out.println("[Thread2] ** LOCK INFO cache2: " + cache2.printLockInfo());
-               tx.commit();
+               tm.commit();
                System.out.println("[Thread2] ** LOCK INFO cache1: " + cache1.printLockInfo());
                System.out.println("[Thread2] ** LOCK INFO cache2: " + cache2.printLockInfo());
             }
@@ -727,11 +727,11 @@
 
          public void run()
          {
-            Transaction tx = null;
+            TransactionManager tm = null;
 
             try
             {
-               tx = beginTransaction();
+               tm = beginTransaction();
                c1.put("/thread/" + getName(), null);
                System.out.println("Thread " + getName() + " after put(): " + c1.toString());
                System.out.println("Thread " + getName() + " waiting on mutex");
@@ -740,7 +740,7 @@
                   mutex.wait();
                }
                System.out.println("Thread " + getName() + " committing");
-               tx.commit();
+               tm.commit();
                System.out.println("Thread " + getName() + " committed successfully");
             }
             catch (Exception e)
@@ -751,8 +751,8 @@
             {
                try
                {
-                  if (tx != null)
-                     tx.rollback();
+                  if (tm != null)
+                     tm.rollback();
                }
                catch (Exception e)
                {
@@ -826,16 +826,16 @@
       final CacheImpl<Object, Object> c2 = this.cache2;
 
       Thread t1 = new Thread() {
-         Transaction tx;
+         TransactionManager tm;
 
          public void run()
          {
             try
             {
-               tx = beginTransaction();
+               tm = beginTransaction();
                c1.put("/ben/wang", "name", "Ben Wang");
                TestingUtil.sleepThread(8000);
-               tx.commit();// This should go thru
+               tm.commit();// This should go thru
             }
             catch (Throwable ex)
             {
@@ -846,16 +846,16 @@
       };
 
       Thread t2 = new Thread() {
-         Transaction tx;
+         TransactionManager tm;
 
          public void run()
          {
             try
             {
                TestingUtil.sleepThread(1000);// give Thread1 time to acquire the lock
-               tx = beginTransaction();
+               tm = beginTransaction();
                c2.put("/ben/wang", "name", "Ben Jr.");
-               tx.commit();// This will time out and rollback first because Thread1 has a tx going as well.
+               tm.commit();// This will time out and rollback first because Thread1 has a tx going as well.
             }
             catch (RollbackException rollback_ex)
             {
@@ -994,23 +994,23 @@
     */
    public void testPutTx() throws Exception
    {
-      Transaction tx = null;
+      TransactionManager tm = null;
 
       try
       {
          initCaches(Configuration.CacheMode.REPL_SYNC);
          cache1.getConfiguration().setSyncCommitPhase(true);
          cache2.getConfiguration().setSyncCommitPhase(true);
-         tx = beginTransaction();
+         tm = beginTransaction();
          cache1.put("/a/b/c", "age", 38);
          cache1.put("/a/b/c", "age", 39);
          Object val = cache2.get("/a/b/c", "age");// must be null as not yet committed
          assertNull(val);
-         tx.commit();
+         tm.commit();
 
-         tx = beginTransaction();
+         tm = beginTransaction();
          assertEquals(39, cache2.get("/a/b/c", "age"));// must not be null
-         tx.commit();
+         tm.commit();
       }
       catch (Throwable t)
       {
@@ -1036,12 +1036,12 @@
       Thread t1 = new Thread() {
          public void run()
          {
-            Transaction tx = null;
+            TransactionManager tm = null;
 
             try
             {
                lock.acquire();
-               tx = beginTransaction();
+               tm = beginTransaction();
                c1.put("/a/b/c", "age", 38);
                c1.put("/a/b/c", "age", 39);
                lock.release();
@@ -1050,7 +1050,7 @@
                lock.acquire();
                try
                {
-                  tx.commit();
+                  tm.commit();
                }
                catch (RollbackException ex)
                {
@@ -1076,14 +1076,14 @@
       Thread t2 = new Thread() {
          public void run()
          {
-            Transaction tx = null;
+            TransactionManager tm = null;
 
             try
             {
                sleep(200);
                Thread.yield();
                lock.acquire();
-               tx = beginTransaction();
+               tm = beginTransaction();
                assertNull(cache2.get("/a/b/c", "age"));// must be null as not yet committed
                cache2.put("/a/b/c", "age", 40);
                lock.release();
@@ -1091,13 +1091,13 @@
                TestingUtil.sleepThread(300);
                lock.acquire();
                assertEquals(40, cache2.get("/a/b/c", "age"));// must not be null
-               tx.commit();
+               tm.commit();
                lock.release();
 
                TestingUtil.sleepThread(1000);
-               tx = beginTransaction();
+               tm = beginTransaction();
                assertEquals("After cache2 commit", 40, cache2.get("/a/b/c", "age"));
-               tx.commit();
+               tm.commit();
             }
             catch (Throwable ex)
             {
@@ -1135,19 +1135,19 @@
       Thread t1 = new Thread() {
          public void run()
          {
-            Transaction tx = null;
+            TransactionManager tm = null;
 
             try
             {
                lock.acquire();
-               tx = beginTransaction();
+               tm = beginTransaction();
                c2.put("/a/b/c", "age", 38);
                c2.put("/a/b/c", "age", 39);
                lock.release();
 
                TestingUtil.sleepThread(100);
                lock.acquire();
-               tx.rollback();
+               tm.rollback();
                lock.release();
             }
             catch (Throwable ex)
@@ -1165,21 +1165,21 @@
       Thread t2 = new Thread() {
          public void run()
          {
-            Transaction tx = null;
+            TransactionManager tm = null;
 
             try
             {
                sleep(200);
                Thread.yield();
                lock.acquire();
-               tx = beginTransaction();
+               tm = beginTransaction();
                assertNull(cache2.get("/a/b/c", "age"));// must be null as not yet committed
                lock.release();
 
                TestingUtil.sleepThread(100);
                lock.acquire();
                assertNull(cache2.get("/a/b/c", "age"));// must be null as rolledback
-               tx.commit();
+               tm.commit();
                lock.release();
             }
             catch (Throwable ex)

Modified: core/trunk/src/test/java/org/jboss/cache/statetransfer/ForcedStateTransferTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/statetransfer/ForcedStateTransferTest.java	2007-10-03 21:55:00 UTC (rev 4535)
+++ core/trunk/src/test/java/org/jboss/cache/statetransfer/ForcedStateTransferTest.java	2007-10-04 00:23:11 UTC (rev 4536)
@@ -144,7 +144,7 @@
     */
    static class TxRunner extends TaskRunner
    {
-      Transaction tx = null;
+      TransactionManager tm = null;
       boolean rollback = false;
       boolean done = true;
 
@@ -156,14 +156,13 @@
 
       void executeTask() throws Exception
       {
-         TransactionManager tm = cache.getTransactionManager();
+         tm = cache.getTransactionManager();
          tm.begin();
-         tx = tm.getTransaction();
 
          cache.put(fqn, "KEY", value);
 
          if (rollback)
-            tx.setRollbackOnly();
+            tm.setRollbackOnly();
 
          asleep = true;
          TestingUtil.sleepThread((long) 25000);
@@ -172,11 +171,11 @@
 
       void finalCleanup()
       {
-         if (tx != null)
+         if (tm != null)
          {
             try
             {
-               tx.commit();
+               tm.commit();
             }
             catch (Exception ignore)
             {
@@ -322,7 +321,7 @@
          cache.put(fqn, "KEY", value);
 
          // Committing the tx will hang the thread
-         tx.commit();
+         tm.commit();
       }
 
       boolean isAsleep()

Modified: core/trunk/src/test/java/org/jboss/cache/transaction/AbortionTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/transaction/AbortionTest.java	2007-10-03 21:55:00 UTC (rev 4535)
+++ core/trunk/src/test/java/org/jboss/cache/transaction/AbortionTest.java	2007-10-04 00:23:11 UTC (rev 4536)
@@ -152,9 +152,8 @@
       mgr3.setNotification(new TestNotification(abortBeforeCompletion));
 
       mgr1.begin();
-      Transaction tx = mgr1.getTransaction();
       cache1.put("/test", "key", "value2");
-      tx.commit();
+      mgr1.commit();
 
       TestingUtil.sleepThread(5000);
 

Modified: core/trunk/src/test/java/org/jboss/cache/transaction/DeadlockTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/transaction/DeadlockTest.java	2007-10-03 21:55:00 UTC (rev 4535)
+++ core/trunk/src/test/java/org/jboss/cache/transaction/DeadlockTest.java	2007-10-04 00:23:11 UTC (rev 4536)
@@ -283,7 +283,7 @@
 
    class GenericThread extends Thread
    {
-      protected Transaction tx;
+      protected TransactionManager tm;
       protected boolean looping = true;
 
       public GenericThread()
@@ -347,20 +347,20 @@
                {
                   break;
                }
-               tx = startTransaction();
+               tm = startTransaction();
                log("remove(" + fqn + ")");
                cache.remove(fqn);
                sleep(random(20));
-               tx.commit();
+               tm.commit();
             }
             catch (InterruptedException interrupted)
             {
-               tx.rollback();
+               tm.rollback();
                break;
             }
             catch (Exception ex)
             {
-               tx.rollback();
+               tm.rollback();
                throw ex;
             }
          }
@@ -387,20 +387,20 @@
                {
                   break;
                }
-               tx = startTransaction();
+               tm = startTransaction();
                log("put(" + fqn + ")");
                cache.put(fqn, "foo", "bar");
                sleep(random(20));
-               tx.commit();
+               tm.commit();
             }
             catch (InterruptedException interrupted)
             {
-               tx.rollback();
+               tm.rollback();
                break;
             }
             catch (Exception ex)
             {
-               tx.rollback();
+               tm.rollback();
                throw ex;
             }
          }
@@ -424,7 +424,7 @@
 
       protected void _run() throws Exception
       {
-         tx = startTransaction();
+         tm = startTransaction();
          log("get(" + fqn + ")");
          cache.get(fqn, "bla");// acquires RL
          log("done, locks: " + cache.printLockInfo());
@@ -437,7 +437,7 @@
          log("put(" + fqn + ")");
          cache.put(fqn, "key", "val");// need to upgrade RL to WL
          log("done, locks: " + cache.printLockInfo());
-         tx.commit();
+         tm.commit();
          log("committed TX, locks: " + cache.printLockInfo());
       }
    }
@@ -459,7 +459,7 @@
 
       protected void _run() throws Exception
       {
-         tx = startTransaction();
+         tm = startTransaction();
          try
          {
             log("get(" + fqn + ")");
@@ -474,13 +474,13 @@
             log("put(" + fqn + ")");
             cache.put(fqn, "key", "val");// need to upgrade RL to WL
             log("done, locks: " + cache.printLockInfo());
-            tx.commit();
+            tm.commit();
             log("committed TX, locks: " + cache.printLockInfo());
          }
          catch (UpgradeException upge)
          {
             log("Exception upgrading lock");
-            tx.rollback();
+            tm.rollback();
          }
       }
    }
@@ -502,13 +502,13 @@
          catch (UpgradeException upgradeEx)
          {
             log("received UpgradeException as expected");
-            tx.rollback();
+            tm.rollback();
             log("rolled back TX, locks: " + cache.printLockInfo());
          }
          catch (TimeoutException timeoutEx)
          {
             log("received TimeoutException as expected");
-            tx.rollback();
+            tm.rollback();
             log("rolled back TX, locks: " + cache.printLockInfo());
          }
       }
@@ -527,7 +527,7 @@
 
       protected void _run() throws Exception
       {
-         tx = startTransaction();
+         tm = startTransaction();
          log("put(" + fqn1 + ")");
          cache.put(fqn1, "key", "val");// need to upgrade RL to WL
          log("done, locks: " + cache.printLockInfo());
@@ -538,7 +538,7 @@
          log("put(" + fqn2 + ")");
          cache.put(fqn2, "key", "val");// need to upgrade RL to WL
          log("done, locks: " + cache.printLockInfo());
-         tx.commit();
+         tm.commit();
          log("committed TX, locks: " + cache.printLockInfo());
       }
    }
@@ -560,7 +560,7 @@
          catch (TimeoutException timeoutEx)
          {
             log("received TimeoutException as expected");
-            tx.rollback();
+            tm.rollback();
             log("rolled back TX, locks: " + cache.printLockInfo());
          }
       }
@@ -571,12 +571,11 @@
       System.out.println(Thread.currentThread().getName() + ": " + msg);
    }
 
-   private Transaction startTransaction() throws SystemException, NotSupportedException
+   private TransactionManager startTransaction() throws SystemException, NotSupportedException
    {
       TransactionManager mgr = cache.getTransactionManager();
       mgr.begin();
-      Transaction tx = mgr.getTransaction();
-      return tx;
+      return mgr;
    }
 
 }

Modified: core/trunk/src/test/java/org/jboss/cache/transaction/IsolationLevelNoneTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/transaction/IsolationLevelNoneTest.java	2007-10-03 21:55:00 UTC (rev 4535)
+++ core/trunk/src/test/java/org/jboss/cache/transaction/IsolationLevelNoneTest.java	2007-10-04 00:23:11 UTC (rev 4536)
@@ -30,7 +30,7 @@
    final Fqn FQN = Fqn.fromString("/a/b/c");
    final String KEY = "key";
    final String VALUE = "value";
-   Transaction tx;
+   TransactionManager tm;
 
    @AfterMethod(alwaysRun = true)
    public void tearDown() throws Exception
@@ -66,14 +66,14 @@
       cache.getConfiguration().setIsolationLevel(IsolationLevel.NONE);
       cache.getConfiguration().setTransactionManagerLookupClass(TransactionSetup.getManagerLookup());
       cache.start();
-      tx = startTransaction();
+      tm = startTransaction();
       cache.put(FQN, KEY, VALUE);
       cache.put(FQN + "/d", KEY, VALUE);
       assertTrue(cache.exists(FQN, KEY));
       assertEquals(VALUE, cache.get(FQN, KEY));
       System.out.println("cache: " + cache.toString(true) + ", locks: " + cache.printLockInfo());
       assertEquals(0, cache.getNumberOfLocksHeld());
-      tx.commit();
+      tm.commit();
    }
 
    public void testWithTransactionsRepeatableRead() throws Exception
@@ -84,20 +84,20 @@
       cache.getConfiguration().setIsolationLevel(IsolationLevel.REPEATABLE_READ);
       cache.getConfiguration().setTransactionManagerLookupClass(TransactionSetup.getManagerLookup());
       cache.start();
-      tx = startTransaction();
+      tm = startTransaction();
       cache.put(FQN, KEY, VALUE);
       cache.put(FQN + "/d", KEY, VALUE);
       assertTrue(cache.exists(FQN, KEY));
       assertEquals(VALUE, cache.get(FQN, KEY));
       System.out.println("cache: " + cache.toString(true) + ", locks: " + cache.printLockInfo());
       assertEquals(5, cache.getNumberOfLocksHeld());
-      tx.commit();
+      tm.commit();
    }
 
-   private Transaction startTransaction() throws SystemException, NotSupportedException
+   private TransactionManager startTransaction() throws SystemException, NotSupportedException
    {
       TransactionManager mgr = cache.getTransactionManager();
       mgr.begin();
-      return mgr.getTransaction();
+      return mgr;
    }
 }

Modified: core/trunk/src/test/java/org/jboss/cache/transaction/IsolationLevelReadCommittedNodeCreationRollbackTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/transaction/IsolationLevelReadCommittedNodeCreationRollbackTest.java	2007-10-03 21:55:00 UTC (rev 4535)
+++ core/trunk/src/test/java/org/jboss/cache/transaction/IsolationLevelReadCommittedNodeCreationRollbackTest.java	2007-10-04 00:23:11 UTC (rev 4536)
@@ -95,7 +95,7 @@
          {
             try
             {
-               Transaction tx = startTransaction();
+               TransactionManager tm = startTransaction();
 
                System.out.println("Writing /a/1");
 
@@ -111,7 +111,7 @@
 
                System.out.println("rolling back");
 
-               tx.rollback();
+               tm.rollback();
 
                assertNull("a1 empty", cache.get(a1, KEY));
 
@@ -218,11 +218,11 @@
       }
    }
 
-   private Transaction startTransaction() throws SystemException, NotSupportedException
+   private TransactionManager startTransaction() throws SystemException, NotSupportedException
    {
       TransactionManager mgr = cache.getTransactionManager();
       mgr.begin();
-      return mgr.getTransaction();
+      return mgr;
    }
 
 }

Modified: core/trunk/src/test/java/org/jboss/cache/transaction/IsolationLevelReadCommittedTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/transaction/IsolationLevelReadCommittedTest.java	2007-10-03 21:55:00 UTC (rev 4535)
+++ core/trunk/src/test/java/org/jboss/cache/transaction/IsolationLevelReadCommittedTest.java	2007-10-04 00:23:11 UTC (rev 4536)
@@ -98,10 +98,10 @@
       Thread readerThread = new Thread(new Runnable() {
          public void run()
          {
-            Transaction tx = null;
+            TransactionManager tm = null;
             try
             {
-               tx = startTransaction();
+               tm = startTransaction();
 
                // Read the value, thus acquiring a read lock on FQN
                assertEquals("Could not read node with expected value!", VALUE, cache.get(FQN, KEY));
@@ -140,11 +140,11 @@
             finally
             {
                System.out.println("reader thread exits");
-               if (tx != null)
+               if (tm != null)
                {
                   try
                   {
-                     tx.commit();
+                     tm.commit();
                   }
                   catch (Exception e)
                   {
@@ -169,7 +169,7 @@
 
                writerCanWrite.await(3, TimeUnit.SECONDS);
 
-               Transaction tx2 = startTransaction();
+               TransactionManager tm = startTransaction();
 
                // change VALUE in a transaction
                cache.put(FQN, KEY, "this-shouldnt-be-visible");
@@ -182,7 +182,7 @@
 
                System.out.println("rolling back");
 
-               tx2.rollback();
+               tm.rollback();
             }
             catch (AssertionFailedError e)
             {
@@ -252,7 +252,7 @@
          {
             try
             {
-               Transaction tx = startTransaction();
+               TransactionManager mgr = startTransaction();
 
                // change VALUE in a transaction
                cache.removeNode(PARENT_FQN);
@@ -262,7 +262,7 @@
 
                readerDone.await();
 
-               tx.commit();
+               mgr.commit();
             }
             catch (AssertionFailedError e)
             {
@@ -321,11 +321,11 @@
 
    }
 
-   private Transaction startTransaction() throws SystemException, NotSupportedException
+   private TransactionManager startTransaction() throws SystemException, NotSupportedException
    {
       TransactionManager mgr = cache.getConfiguration().getRuntimeConfig().getTransactionManager();
       mgr.begin();
-      return mgr.getTransaction();
+      return mgr;
    }
 
 }

Modified: core/trunk/src/test/java/org/jboss/cache/transaction/IsolationLevelRepeatableReadTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/transaction/IsolationLevelRepeatableReadTest.java	2007-10-03 21:55:00 UTC (rev 4535)
+++ core/trunk/src/test/java/org/jboss/cache/transaction/IsolationLevelRepeatableReadTest.java	2007-10-04 00:23:11 UTC (rev 4536)
@@ -85,7 +85,7 @@
          {
             try
             {
-               Transaction tx = startTransaction();
+               TransactionManager tm = startTransaction();
 
                // change VALUE in a transaction
                cache.remove(FQN);
@@ -95,7 +95,7 @@
 
                readerDone.await();
 
-               tx.commit();
+               tm.commit();
             }
             catch (AssertionFailedError e)
             {
@@ -154,11 +154,11 @@
 
    }
 
-   private Transaction startTransaction() throws SystemException, NotSupportedException
+   private TransactionManager startTransaction() throws SystemException, NotSupportedException
    {
       TransactionManager mgr = cache.getTransactionManager();
       mgr.begin();
-      return mgr.getTransaction();
+      return mgr;
    }
 
 }

Modified: core/trunk/src/test/java/org/jboss/cache/transaction/IsolationLevelSerializableTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/transaction/IsolationLevelSerializableTest.java	2007-10-03 21:55:00 UTC (rev 4535)
+++ core/trunk/src/test/java/org/jboss/cache/transaction/IsolationLevelSerializableTest.java	2007-10-04 00:23:11 UTC (rev 4536)
@@ -91,7 +91,7 @@
          {
             try
             {
-               Transaction tx = startTransaction();
+               TransactionManager tx = startTransaction();
 
                // change VALUE in a transaction
                cache.removeNode(FQN);
@@ -160,11 +160,11 @@
 
    }
 
-   private Transaction startTransaction() throws SystemException, NotSupportedException
+   private TransactionManager startTransaction() throws SystemException, NotSupportedException
    {
       TransactionManager mgr = cache.getConfiguration().getRuntimeConfig().getTransactionManager();
       mgr.begin();
-      return mgr.getTransaction();
+      return mgr;
    }
 
 }

Modified: core/trunk/src/test/java/org/jboss/cache/transaction/PrepareTxTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/transaction/PrepareTxTest.java	2007-10-03 21:55:00 UTC (rev 4535)
+++ core/trunk/src/test/java/org/jboss/cache/transaction/PrepareTxTest.java	2007-10-04 00:23:11 UTC (rev 4536)
@@ -85,7 +85,7 @@
          }
       });
 
-      tx.commit();
+      mgr.commit();
       System.out.println("after commit:\n" + cache.printLockInfo());
       numLocks = cache.getNumberOfLocksHeld();
       assertEquals(0, numLocks);
@@ -141,7 +141,7 @@
          }
       });
 
-      tx.commit();
+      mgr.commit();
       System.out.println("after commit:\n" + cache.printLockInfo());
       numLocks = cache.getNumberOfLocksHeld();
       assertEquals(0, numLocks);

Modified: core/trunk/src/test/java/org/jboss/cache/transaction/TransactionTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/transaction/TransactionTest.java	2007-10-03 21:55:00 UTC (rev 4535)
+++ core/trunk/src/test/java/org/jboss/cache/transaction/TransactionTest.java	2007-10-04 00:23:11 UTC (rev 4536)
@@ -25,6 +25,7 @@
 import javax.transaction.RollbackException;
 import javax.transaction.SystemException;
 import javax.transaction.Transaction;
+import javax.transaction.TransactionManager;
 import javax.transaction.UserTransaction;
 
 import org.jboss.cache.CacheException;
@@ -565,12 +566,13 @@
       tx.begin();
       cache.remove("/a/b/c");
       // this node should now be locked.
-      Transaction t = cache.getTransactionManager().suspend();
+      TransactionManager tm = cache.getConfiguration().getRuntimeConfig().getTransactionManager();
+      Transaction t = tm.suspend();
       Transaction t2;
       System.out.println(cache.printLockInfo());
       // start a new tx
-      cache.getTransactionManager().begin();
-      t2 = cache.getTransactionManager().getTransaction();
+      tm.begin();
+      t2 = tm.getTransaction();
       try
       {
          cache.get("/a/b/c");// should fail
@@ -580,10 +582,10 @@
       {
          // expected
          //cache.getTransactionManager().commit();
-         t2.commit();
+         tm.commit();
       }
 
-      cache.getTransactionManager().resume(t);
+      tm.resume(t);
       tx.rollback();
 
       assertNotNull(cache.get("/a/b/c"));
@@ -869,11 +871,11 @@
       assertEquals("Node should keep the commited value", "commit", cache.get(FQN).get("entry"));// THIS FAILS
    }
 
-   private Transaction startTransaction() throws Exception
+   private TransactionManager startTransaction() throws Exception
    {
-      DummyTransactionManager mgr = DummyTransactionManager.getInstance();
+      TransactionManager mgr = cache.getConfiguration().getRuntimeConfig().getTransactionManager();
       mgr.begin();
-      return mgr.getTransaction();
+      return mgr;
    }
 
    public void testConcurrentReadAndWriteAccess() throws Exception
@@ -886,7 +888,7 @@
 
       class Reader extends Thread
       {
-         Transaction thread_tx;
+         TransactionManager thread_tx;
 
          public Reader()
          {
@@ -915,7 +917,7 @@
 
       class Writer extends Thread
       {
-         Transaction thread_tx;
+         TransactionManager thread_tx;
 
          public Writer()
          {




More information about the jbosscache-commits mailing list