[jboss-cvs] JBoss Messaging SVN: r2121 - in trunk: tests/src/org/jboss/test/messaging/jms/clustering and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Feb 1 02:39:37 EST 2007


Author: clebert.suconic at jboss.com
Date: 2007-02-01 02:39:36 -0500 (Thu, 01 Feb 2007)
New Revision: 2121

Modified:
   trunk/src/main/org/jboss/jms/client/FailoverValve.java
   trunk/tests/src/org/jboss/test/messaging/jms/clustering/FailoverValveTest.java
Log:
Simplifying valve....
Keeping the counter I removed here is costly (as it requires synchronization) however this counter is not used anywhere. So I have removed it.

Modified: trunk/src/main/org/jboss/jms/client/FailoverValve.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/FailoverValve.java	2007-02-01 02:10:44 UTC (rev 2120)
+++ trunk/src/main/org/jboss/jms/client/FailoverValve.java	2007-02-01 07:39:36 UTC (rev 2121)
@@ -53,7 +53,6 @@
 
    private ReadWriteLock lock;
 
-   private int activeLocks = 0;
    private int activeCloses = 0;
 
    // these are only initialized if tracing is enabled
@@ -102,11 +101,6 @@
 
       getCounter().counter++;
 
-      synchronized (this)
-      {
-         activeLocks++;
-      }
-
       if (trace)
       {
          Exception ex = new Exception();
@@ -125,11 +119,6 @@
          throw new IllegalStateException("leave() was called without a prior enter() call");
       }
 
-      synchronized (this)
-      {
-         activeLocks--;
-      }
-
       if (trace)
       {
          Exception ex = (Exception) getStackEnters().pop();
@@ -177,7 +166,6 @@
       log.debug(this + " closed");
 
       activeCloses++;
-      activeLocks++;
 
       // Sanity check only...
       if (activeCloses > 1)
@@ -196,7 +184,7 @@
 
    public void open() throws InterruptedException
    {
-      if (activeCloses <= 0 || activeLocks <= 0)
+      if (activeCloses <= 0)
       {
          throw new IllegalStateException("Valve not closed");
       }
@@ -204,7 +192,6 @@
       log.debug(this + " opening ...");
 
       activeCloses--;
-      activeLocks--;
 
       lock.writeLock().release();
 
@@ -224,11 +211,6 @@
       log.debug(this + " opened");
    }
 
-   public synchronized int getActiveLocks()
-   {
-      return activeLocks;
-   }
-
    public String toString()
    {
       return "FailoverValve[" +

Modified: trunk/tests/src/org/jboss/test/messaging/jms/clustering/FailoverValveTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/clustering/FailoverValveTest.java	2007-02-01 02:10:44 UTC (rev 2120)
+++ trunk/tests/src/org/jboss/test/messaging/jms/clustering/FailoverValveTest.java	2007-02-01 07:39:36 UTC (rev 2121)
@@ -88,8 +88,6 @@
             fail("One of threads had a failure, look at logs");
          }
       }
-
-      assertEquals (0, valve.getActiveLocks());
    }
 
    // Validate weird usages that are supposed to throw exceptions




More information about the jboss-cvs-commits mailing list