[hornetq-commits] JBoss hornetq SVN: r9070 - trunk/src/main/org/hornetq/core/journal/impl.

do-not-reply at jboss.org do-not-reply at jboss.org
Wed Apr 7 17:45:15 EDT 2010


Author: clebert.suconic at jboss.com
Date: 2010-04-07 17:45:14 -0400 (Wed, 07 Apr 2010)
New Revision: 9070

Modified:
   trunk/src/main/org/hornetq/core/journal/impl/TimedBuffer.java
Log:
HORNETQ-354 - minor optimization on TimedBuffer (possible cause for JBAS-7877). 
Acquiring the semaphore before starting the CheckTimer thread maybe could avoid competing for the semaphore.acquire during startup.
The sempahore needs to be acquired anyway, so i will remove this possibility just in case

Modified: trunk/src/main/org/hornetq/core/journal/impl/TimedBuffer.java
===================================================================
--- trunk/src/main/org/hornetq/core/journal/impl/TimedBuffer.java	2010-04-07 14:37:50 UTC (rev 9069)
+++ trunk/src/main/org/hornetq/core/journal/impl/TimedBuffer.java	2010-04-07 21:45:14 UTC (rev 9070)
@@ -127,6 +127,16 @@
          return;
       }
 
+
+      // Need to start with the spin limiter acquired
+      try
+      {
+         spinLimiter.acquire();
+      }
+      catch (InterruptedException ignore)
+      {
+      }
+
       timerRunnable = new CheckTimer();
 
       timerThread = new Thread(timerRunnable, "hornetq-buffer-timeout");
@@ -140,15 +150,6 @@
          logRatesTimer.scheduleAtFixedRate(logRatesTimerTask, 2000, 2000);
       }
 
-      // Need to start with the spin limiter acquired
-      try
-      {
-         spinLimiter.acquire();
-      }
-      catch (InterruptedException ignore)
-      {
-      }
-
       started = true;
    }
 
@@ -163,10 +164,10 @@
 
       bufferObserver = null;
 
+      timerRunnable.close();
+
       spinLimiter.release();
 
-      timerRunnable.close();
-
       if (logRates)
       {
          logRatesTimerTask.cancel();



More information about the hornetq-commits mailing list