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

do-not-reply at jboss.org do-not-reply at jboss.org
Wed Dec 9 05:26:01 EST 2009


Author: timfox
Date: 2009-12-09 05:26:01 -0500 (Wed, 09 Dec 2009)
New Revision: 8634

Modified:
   trunk/src/main/org/hornetq/core/journal/impl/TimedBuffer.java
Log:
https://jira.jboss.org/jira/browse/HORNETQ-241

Modified: trunk/src/main/org/hornetq/core/journal/impl/TimedBuffer.java
===================================================================
--- trunk/src/main/org/hornetq/core/journal/impl/TimedBuffer.java	2009-12-09 10:24:09 UTC (rev 8633)
+++ trunk/src/main/org/hornetq/core/journal/impl/TimedBuffer.java	2009-12-09 10:26:01 UTC (rev 8634)
@@ -115,7 +115,7 @@
 
       callbacks = new ArrayList<IOAsyncTask>();
 
-      this.timeout = timeout;
+      this.timeout = timeout;           
    }
 
    public synchronized void start()
@@ -137,6 +137,15 @@
 
          logRatesTimer.scheduleAtFixedRate(logRatesTimerTask, 2000, 2000);
       }
+      
+      //Need to start with the spin limiter acquired
+      try
+      {
+         spinLimiter.acquire();
+      }
+      catch (InterruptedException ignore)
+      {         
+      }
 
       started = true;
    }
@@ -240,13 +249,6 @@
    {
       delayFlush = false;
 
-      if (buffer.writerIndex() == 0)
-      {
-         // More bytes have been added so the timer flush thread can resume
-
-         spinLimiter.release();
-      }
-
       bytes.encode(buffer);
 
       callbacks.add(callback);
@@ -263,6 +265,13 @@
          //
          // flush();
          // }
+         
+         if (buffer.writerIndex() == 0)
+         {
+            // More bytes have been added so the timer flush thread can resume
+
+            spinLimiter.release();
+         }
       }
 
    }



More information about the hornetq-commits mailing list