Updated Branches:
  refs/heads/trunk 7cf5c240a -> 3b5fa4bf8

Implementing a dirty stop method for the leveldb store that might come in handy 
for testing.


Project: http://git-wip-us.apache.org/repos/asf/activemq/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq/commit/3b5fa4bf
Tree: http://git-wip-us.apache.org/repos/asf/activemq/tree/3b5fa4bf
Diff: http://git-wip-us.apache.org/repos/asf/activemq/diff/3b5fa4bf

Branch: refs/heads/trunk
Commit: 3b5fa4bf8955f15dd1f52703c7578a054beb74e6
Parents: 7cf5c24
Author: Hiram Chirino <[email protected]>
Authored: Thu Dec 5 09:23:26 2013 -0500
Committer: Hiram Chirino <[email protected]>
Committed: Thu Dec 5 09:24:10 2013 -0500

----------------------------------------------------------------------
 .../scala/org/apache/activemq/leveldb/LevelDBClient.scala | 10 +++++++++-
 .../leveldb/replicated/ElectingLevelDBStore.scala         |  1 +
 2 files changed, 10 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq/blob/3b5fa4bf/activemq-leveldb-store/src/main/scala/org/apache/activemq/leveldb/LevelDBClient.scala
----------------------------------------------------------------------
diff --git 
a/activemq-leveldb-store/src/main/scala/org/apache/activemq/leveldb/LevelDBClient.scala
 
b/activemq-leveldb-store/src/main/scala/org/apache/activemq/leveldb/LevelDBClient.scala
index 7872ff8..44f0d44 100755
--- 
a/activemq-leveldb-store/src/main/scala/org/apache/activemq/leveldb/LevelDBClient.scala
+++ 
b/activemq-leveldb-store/src/main/scala/org/apache/activemq/leveldb/LevelDBClient.scala
@@ -971,7 +971,15 @@ class LevelDBClient(store: LevelDBStore) {
     }
   }
 
-  def stop() = this.synchronized {
+  def dirty_stop = this.synchronized {
+    def ingorefailure(func: =>Unit) = try { func } catch { case e:Throwable=> }
+    ingorefailure(index.close)
+    ingorefailure(log.close)
+    ingorefailure(plist.close)
+    ingorefailure(might_fail(throw new IOException("non-clean close")))
+  }
+
+  def stop():Unit = this.synchronized {
     if( writeExecutor!=null ) {
       writeExecutor.shutdown
       writeExecutor.awaitTermination(60, TimeUnit.SECONDS)

http://git-wip-us.apache.org/repos/asf/activemq/blob/3b5fa4bf/activemq-leveldb-store/src/main/scala/org/apache/activemq/leveldb/replicated/ElectingLevelDBStore.scala
----------------------------------------------------------------------
diff --git 
a/activemq-leveldb-store/src/main/scala/org/apache/activemq/leveldb/replicated/ElectingLevelDBStore.scala
 
b/activemq-leveldb-store/src/main/scala/org/apache/activemq/leveldb/replicated/ElectingLevelDBStore.scala
index 90e80c0..55e0419 100644
--- 
a/activemq-leveldb-store/src/main/scala/org/apache/activemq/leveldb/replicated/ElectingLevelDBStore.scala
+++ 
b/activemq-leveldb-store/src/main/scala/org/apache/activemq/leveldb/replicated/ElectingLevelDBStore.scala
@@ -243,6 +243,7 @@ class ElectingLevelDBStore extends ProxyLevelDBStore {
       master_stopped.set(true)
       position = master.wal_append_position
       stopped_latch.countDown()
+      master = null
       func
     })
     master.blocking_executor.execute(^{

Reply via email to