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

This commit is contained in:
Hiram Chirino 2013-12-05 09:23:26 -05:00
parent 7cf5c240a2
commit 3b5fa4bf89
2 changed files with 10 additions and 1 deletions

View File

@ -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)

View File

@ -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(^{