[jbosscache-commits] JBoss Cache SVN: r7307 - core/trunk/src/test/java/org/jboss/cache/transaction.

jbosscache-commits at lists.jboss.org jbosscache-commits at lists.jboss.org
Fri Dec 12 03:51:34 EST 2008


Author: mircea.markus
Date: 2008-12-12 03:51:34 -0500 (Fri, 12 Dec 2008)
New Revision: 7307

Modified:
   core/trunk/src/test/java/org/jboss/cache/transaction/ConcurrentBankTest.java
   core/trunk/src/test/java/org/jboss/cache/transaction/DeadlockTest.java
   core/trunk/src/test/java/org/jboss/cache/transaction/InvocationContextCleanupTest.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/RemoveOnTxTest.java
Log:
removed System.out.print

Modified: core/trunk/src/test/java/org/jboss/cache/transaction/ConcurrentBankTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/transaction/ConcurrentBankTest.java	2008-12-12 08:50:23 UTC (rev 7306)
+++ core/trunk/src/test/java/org/jboss/cache/transaction/ConcurrentBankTest.java	2008-12-12 08:51:34 UTC (rev 7307)
@@ -89,16 +89,9 @@
       one.join();
       two.join();
 
-      log("lock info:\n" + CachePrinter.printCacheLockingInfo(cache) + testFailedinThread);
       assert !testFailedinThread;
    }
 
-   private static void log(String msg)
-   {
-      //      System.out.println("-- [" + Thread.currentThread() + "]: " + msg);
-      log.info("-- [" + Thread.currentThread() + "]: " + msg);
-   }
-
    private class Teller extends Thread
    {
       CacheSPI<Object, Integer> cache;
@@ -138,7 +131,6 @@
                tx.commit();// releases read lock
 
                int sum = sumAccounts(accounts);
-               log(anz + ": " + accounts + " Summe: " + sum);
                // the sum of all accounts always has to be 3000
                if (sum != 3000)
                {
@@ -156,13 +148,11 @@
                }
                catch (TimeoutException timeout_ex)
                {
-                  System.out.println("transaction is rolled back, will try again (ex=" + timeout_ex.getClass() + ")");
                   tx.rollback();
                   again = true;
                }
                catch (Throwable e)
                {
-                  System.out.println("transaction is rolled back, will try again (ex=" + e.getMessage() + ")");
                   tx.rollback();
                   again = true;
                }
@@ -182,17 +172,14 @@
        */
       public void deposit(String from, String to, int amount, UserTransaction tx) throws Exception
       {
-         log("deposit(" + from + ", " + to + ", " + amount + ") called.");
          int act;
          // debit
          act = cache.get(NODE, from);
          cache.put(NODE, from, act - amount);
-         log("deposit(" + from + ", " + to + ", " + amount + ") debited.");
 
          // eventually rollback the transaction
          if ((int) (Math.random() * ROLLBACK_CHANCE) == 0)
          {
-            log("!!!manually set rollback (" + from + ", " + to + ", " + amount + ").");
             tx.setRollbackOnly();
             throw new Exception("Manually set rollback!");
          }
@@ -201,7 +188,6 @@
          act = cache.get(NODE, to);
          cache.put(NODE, to, act + amount);
 
-         log("deposit(" + from + ", " + to + ", " + amount + ") finished.");
       }
 
       /**
@@ -209,7 +195,6 @@
        */
       public HashMap<Object, Integer> getAccounts() throws CacheException
       {
-         log("getAccounts() called.");
          HashMap<Object, Integer> result = new HashMap<Object, Integer>();
          try
          {

Modified: core/trunk/src/test/java/org/jboss/cache/transaction/DeadlockTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/transaction/DeadlockTest.java	2008-12-12 08:50:23 UTC (rev 7306)
+++ core/trunk/src/test/java/org/jboss/cache/transaction/DeadlockTest.java	2008-12-12 08:51:34 UTC (rev 7307)
@@ -224,7 +224,6 @@
       }
 
       TestingUtil.sleepThread((long) 1000);
-      log("locks: " + CachePrinter.printCacheLockingInfo(cache));
 
       synchronized (lock)
       {
@@ -245,9 +244,7 @@
       putter.start();
       remover.start();
       TestingUtil.sleepThread((long) 5000);
-      log("stopping Putter");
       putter.looping = false;
-      log("stopping Remover");
       remover.looping = false;
       putter.join();
       remover.join();
@@ -260,9 +257,7 @@
       putter.start();
       remover.start();
       TestingUtil.sleepThread((long) 5000);
-      log("stopping Putter");
       putter.looping = false;
-      log("stopping Remover");
       remover.looping = false;
       putter.join();
       remover.join();
@@ -275,9 +270,7 @@
       putter.start();
       remover.start();
       TestingUtil.sleepThread((long) 5000);
-      log("stopping Putter");
       putter.looping = false;
-      log("stopping Remover");
       remover.looping = false;
       putter.join();
       remover.join();
@@ -311,7 +304,6 @@
          }
          catch (Exception t)
          {
-            System.out.println(getName() + ": " + t);
             if (thread_ex == null)
             {
                thread_ex = t;
@@ -350,7 +342,6 @@
                   break;
                }
                tm = startTransaction();
-               log("remove(" + fqn + ")");
                cache.removeNode(fqn);
                sleep(random(20));
                tm.commit();
@@ -390,7 +381,6 @@
                   break;
                }
                tm = startTransaction();
-               log("put(" + fqn + ")");
                cache.put(fqn, "foo", "bar");
                sleep(random(20));
                tm.commit();
@@ -427,20 +417,15 @@
       protected void _run() throws Exception
       {
          tm = startTransaction();
-         log("get(" + fqn + ")");
          cache.get(fqn, "bla");// acquires RL
-         log("done, locks: " + CachePrinter.printCacheLockingInfo(cache));
 
          synchronized (this)
          {
             wait();
          }
 
-         log("put(" + fqn + ")");
          cache.put(fqn, "key", "val");// need to upgrade RL to WL
-         log("done, locks: " + CachePrinter.printCacheLockingInfo(cache));
          tm.commit();
-         log("committed TX, locks: " + CachePrinter.printCacheLockingInfo(cache));
       }
    }
 
@@ -464,8 +449,6 @@
          tm = startTransaction();
          try
          {
-            log("get(" + fqn + ")");
-
             cache.get(fqn, "bla");// acquires RL
 
             synchronized (lock)
@@ -473,15 +456,11 @@
                lock.wait();
             }
 
-            log("put(" + fqn + ")");
             cache.put(fqn, "key", "val");// need to upgrade RL to WL
-            log("done, locks: " + CachePrinter.printCacheLockingInfo(cache));
             tm.commit();
-            log("committed TX, locks: " + CachePrinter.printCacheLockingInfo(cache));
          }
          catch (UpgradeException upge)
          {
-            log("Exception upgrading lock");
             tm.rollback();
          }
       }
@@ -503,15 +482,11 @@
          }
          catch (UpgradeException upgradeEx)
          {
-            log("received UpgradeException as expected");
             tm.rollback();
-            log("rolled back TX, locks: " + CachePrinter.printCacheLockingInfo(cache));
          }
          catch (TimeoutException timeoutEx)
          {
-            log("received TimeoutException as expected");
             tm.rollback();
-            log("rolled back TX, locks: " + CachePrinter.printCacheLockingInfo(cache));
          }
       }
    }
@@ -530,18 +505,13 @@
       protected void _run() throws Exception
       {
          tm = startTransaction();
-         log("put(" + fqn1 + ")");
          cache.put(fqn1, "key", "val");// need to upgrade RL to WL
-         log("done, locks: " + CachePrinter.printCacheLockingInfo(cache));
          synchronized (this)
          {
             wait();
          }
-         log("put(" + fqn2 + ")");
          cache.put(fqn2, "key", "val");// need to upgrade RL to WL
-         log("done, locks: " + CachePrinter.printCacheLockingInfo(cache));
          tm.commit();
-         log("committed TX, locks: " + CachePrinter.printCacheLockingInfo(cache));
       }
    }
 
@@ -561,18 +531,11 @@
          }
          catch (TimeoutException timeoutEx)
          {
-            log("received TimeoutException as expected");
             tm.rollback();
-            log("rolled back TX, locks: " + CachePrinter.printCacheLockingInfo(cache));
          }
       }
    }
 
-   private static void log(String msg)
-   {
-      System.out.println(Thread.currentThread().getName() + ": " + msg);
-   }
-
    private TransactionManager startTransaction() throws SystemException, NotSupportedException
    {
       TransactionManager mgr = cache.getTransactionManager();

Modified: core/trunk/src/test/java/org/jboss/cache/transaction/InvocationContextCleanupTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/transaction/InvocationContextCleanupTest.java	2008-12-12 08:50:23 UTC (rev 7306)
+++ core/trunk/src/test/java/org/jboss/cache/transaction/InvocationContextCleanupTest.java	2008-12-12 08:51:34 UTC (rev 7307)
@@ -97,8 +97,6 @@
       {
       }
 
-      System.out.println(CachePrinter.printCacheLockingInfo(caches[0]));
-      System.out.println(CachePrinter.printCacheLockingInfo(caches[1]));
       assertEquals("y", cache0.get("/test", "x"));
       assertEquals("y", cache0.get("/test", "x"));
    }

Modified: core/trunk/src/test/java/org/jboss/cache/transaction/IsolationLevelReadCommittedNodeCreationRollbackTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/transaction/IsolationLevelReadCommittedNodeCreationRollbackTest.java	2008-12-12 08:50:23 UTC (rev 7306)
+++ core/trunk/src/test/java/org/jboss/cache/transaction/IsolationLevelReadCommittedNodeCreationRollbackTest.java	2008-12-12 08:51:34 UTC (rev 7307)
@@ -91,8 +91,6 @@
             {
                TransactionManager tm = startTransaction();
 
-               System.out.println("Writing /a/1");
-
                // Create an empty parent node and a node with data
                Fqn a1 = Fqn.fromRelativeElements(PARENT, "1");
                cache.put(a1, KEY, VALUE);
@@ -103,8 +101,6 @@
                // wait until the second thread writes and allows me to rollback or until I timeout
                firstCanRollback.await(3000, TimeUnit.MILLISECONDS);
 
-               System.out.println("rolling back");
-
                tm.rollback();
 
                assertNull("a1 empty", cache.get(a1, KEY));
@@ -123,7 +119,6 @@
             }
             finally
             {
-               System.out.println("first thread exits");
                secondCanWrite.countDown();
                secondCanRead.countDown();
                firstDone.countDown();
@@ -143,8 +138,6 @@
                // wait until the first thread has created PARENT and a child
                secondCanWrite.await();
 
-               System.out.println("writing a2");
-
                // create a second child under parent
                Fqn a2 = Fqn.fromRelativeElements(PARENT, "2");
                try
@@ -154,7 +147,6 @@
                catch (TimeoutException good)
                {
                   // first thread locked us out of parent
-                  System.out.println("Prevented from writing a2 -- " + good.getLocalizedMessage());
                   return;
                }
 
@@ -178,7 +170,6 @@
             }
             finally
             {
-               System.out.println("second thread exits");
                firstCanRollback.countDown();
                secondDone.countDown();
             }

Modified: core/trunk/src/test/java/org/jboss/cache/transaction/IsolationLevelReadCommittedTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/transaction/IsolationLevelReadCommittedTest.java	2008-12-12 08:50:23 UTC (rev 7306)
+++ core/trunk/src/test/java/org/jboss/cache/transaction/IsolationLevelReadCommittedTest.java	2008-12-12 08:51:34 UTC (rev 7307)
@@ -132,7 +132,6 @@
             }
             finally
             {
-               System.out.println("reader thread exits");
                if (tm != null)
                {
                   try
@@ -174,8 +173,6 @@
                // wait until the reader thread reads and allows me to rollback or until I timeout
                writerCanWrite.await(3, TimeUnit.SECONDS);
 
-               System.out.println("rolling back");
-
                tm.rollback();
             }
             catch (AssertionError e)
@@ -189,7 +186,6 @@
             }
             finally
             {
-               System.out.println("writer thread exits");
                readerCanRead.countDown();
                writerDone.countDown();
             }
@@ -270,7 +266,6 @@
             }
             finally
             {
-               System.out.println("writer thread exits");
                readerCanRead.countDown();
                writerDone.countDown();
             }
@@ -293,7 +288,6 @@
       }
       finally
       {
-         System.out.println("reader thread exits");
          readerDone.countDown();
       }
 

Modified: core/trunk/src/test/java/org/jboss/cache/transaction/IsolationLevelRepeatableReadTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/transaction/IsolationLevelRepeatableReadTest.java	2008-12-12 08:50:23 UTC (rev 7306)
+++ core/trunk/src/test/java/org/jboss/cache/transaction/IsolationLevelRepeatableReadTest.java	2008-12-12 08:51:34 UTC (rev 7307)
@@ -106,7 +106,6 @@
             }
             finally
             {
-               System.out.println("writer thread exits");
                readerCanRead.countDown();
                writerDone.countDown();
             }
@@ -129,7 +128,6 @@
       }
       finally
       {
-         System.out.println("reader thread exits");
          readerDone.countDown();
       }
 

Modified: core/trunk/src/test/java/org/jboss/cache/transaction/IsolationLevelSerializableTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/transaction/IsolationLevelSerializableTest.java	2008-12-12 08:50:23 UTC (rev 7306)
+++ core/trunk/src/test/java/org/jboss/cache/transaction/IsolationLevelSerializableTest.java	2008-12-12 08:51:34 UTC (rev 7307)
@@ -107,7 +107,6 @@
             }
             finally
             {
-               System.out.println("writer thread exits");
                readerCanRead.countDown();
                writerDone.countDown();
             }
@@ -130,7 +129,6 @@
       }
       finally
       {
-         System.out.println("reader thread exits");
          readerDone.countDown();
       }
 

Modified: core/trunk/src/test/java/org/jboss/cache/transaction/RemoveOnTxTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/transaction/RemoveOnTxTest.java	2008-12-12 08:50:23 UTC (rev 7306)
+++ core/trunk/src/test/java/org/jboss/cache/transaction/RemoveOnTxTest.java	2008-12-12 08:51:34 UTC (rev 7307)
@@ -69,18 +69,14 @@
       try
       {
          tm.begin();
-         print("put()");
          cache.put("/a/b/c", "test", "test");
          assertTrue(cache.get("/a/b/c", "test").equals("test"));
-         print("remove()");
          cache.removeNode("/a/b");
          assertTrue(!cache.exists("/a/b"));
          assertTrue(!cache.exists("/a/b/c"));
          cache.put("/a/b/d", "test1", "test1");
          assertTrue(!cache.exists("/a/b/c"));
          assertTrue(cache.exists("/a/b/d"));
-         print("Exists? " + cache.exists("/a/b/c"));
-         print("get(): " + cache.get("/a/b/c", "test"));
          tm.commit();
          assertTrue(cache.peek(Fqn.fromString("/a/b/c"), true, true) == null);
          assertTrue(!cache.exists("/a/b/c"));
@@ -92,13 +88,9 @@
          throw ex;
       }
       dataContainer.printLockInfo();
-      System.out.println(" lock info " + dataContainer.printLockInfo());
       try
       {
          tm.begin();
-         print(cache.exists("/a/b/c"));
-         print("get(): " + cache.get("/a/b/c", "test"));
-         print("get(): " + cache.get("/a/b/c", "test"));
          Transaction t = tm.suspend();
          try
          {
@@ -108,10 +100,7 @@
             ignore.printStackTrace();
          }
          tm.resume(t);
-         print("get(): " + cache.get("/a/b/c", "test"));
-         print(cache.exists("/a/b/c"));
          cache.put("/a/b/c", "test", "test");
-         print(cache.exists("/a/b/c"));
          tm.commit();
       }
       catch (Exception ex) {
@@ -120,32 +109,19 @@
       }
    }
 
-   private void print(Object s)
-   {
-      System.out.println(s);
-   }
 
-   private void print(boolean s)
-   {
-      System.out.println(s);
-   }
-
    public void testReal() throws Exception
    {
       TransactionManager tm = cache.getTransactionManager();
       tm.begin();
-      print("put()");
       cache.put("/a/b/c", "test", "test");
       assertTrue(cache.get("/a/b/c", "test").equals("test"));
-      print("remove()");
       cache.removeNode("/a/b");
       assertTrue(!cache.exists("/a/b"));
       assertTrue(!cache.exists("/a/b/c"));
       cache.put("/a/b/d", "test1", "test1");
       assertTrue(!cache.exists("/a/b/c"));
       assertTrue(cache.exists("/a/b/d"));
-      print("Exists? " + cache.exists("/a/b/c"));
-      print("get(): " + cache.get("/a/b/c", "test"));
       tm.commit();
       assertNull(cache.peek(Fqn.fromString("/a/b/c"), true, true));
       assertTrue(!cache.exists("/a/b/c"));
@@ -157,7 +133,6 @@
    {
       TransactionManager tm = cache.getTransactionManager();
       tm.begin();
-      print("put()");
       cache.put("/a/b/c", "test", "test");
       assertTrue(cache.peek(Fqn.fromString("/a/b/c"), true, true) != null);
       cache.removeNode("/a/b");




More information about the jbosscache-commits mailing list