You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ch...@apache.org on 2010/07/07 06:10:08 UTC

svn commit: r961142 - /activemq/sandbox/activemq-apollo-actor/activemq-hawtdb/src/main/scala/org/apache/activemq/broker/store/hawtdb/HawtDBClient.scala

Author: chirino
Date: Wed Jul  7 04:10:07 2010
New Revision: 961142

URL: http://svn.apache.org/viewvc?rev=961142&view=rev
Log:
avoid doing a couple of flushes

Modified:
    activemq/sandbox/activemq-apollo-actor/activemq-hawtdb/src/main/scala/org/apache/activemq/broker/store/hawtdb/HawtDBClient.scala

Modified: activemq/sandbox/activemq-apollo-actor/activemq-hawtdb/src/main/scala/org/apache/activemq/broker/store/hawtdb/HawtDBClient.scala
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-hawtdb/src/main/scala/org/apache/activemq/broker/store/hawtdb/HawtDBClient.scala?rev=961142&r1=961141&r2=961142&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-hawtdb/src/main/scala/org/apache/activemq/broker/store/hawtdb/HawtDBClient.scala (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-hawtdb/src/main/scala/org/apache/activemq/broker/store/hawtdb/HawtDBClient.scala Wed Jul  7 04:10:07 2010
@@ -159,7 +159,7 @@ class HawtDBClient(hawtDBStore: HawtDBSt
       pageFileFactory.setPageSize(512.toShort)
       pageFileFactory.open()
 
-      withTx { tx =>
+      val initialized = withTx { tx =>
           val helper = new TxHelper(tx)
           import helper._
 
@@ -175,12 +175,17 @@ class HawtDBClient(hawtDBStore: HawtDBSt
 
             tx.put(DATABASE_ROOT_RECORD_ACCESSOR, 0, databaseRootRecord.freeze)
             databaseRootRecord = databaseRootRecord.copy
+            true
           } else {
             databaseRootRecord = tx.get(DATABASE_ROOT_RECORD_ACCESSOR, 0).copy
+            false
           }
       }
 
-      pageFile.flush()
+      if( initialized ) {
+        pageFile.flush()
+      }
+
       recover(onComplete)
 
       // Schedual periodic jobs.. they keep executing while schedual_version remains the same.
@@ -192,7 +197,6 @@ class HawtDBClient(hawtDBStore: HawtDBSt
   def stop() = {
     schedual_version.incrementAndGet
     journal.close
-    flush
     pageFileFactory.close
     lockFile.unlock
   }