ISPN-4651 LevelDB crashes JVM when stop() is called concurrently with write()

https://issues.jboss.org/browse/ISPN-4651
@danberindei We don't need any further booleans, IMO, and the loop does not need to be busy: we could do a loop with drainPermits() followed by acquire(1) - acquire would give us the blocking wait and protect us from the livelock (well, kind of), while draining should help us lock asap.

I agree that this is getting more complicated and that functionality should go to separate class.