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

https://issues.jboss.org/browse/ISPN-4651
Actually the case this is fixing is fairly synthetic so I'd prefer the
lightweight solution like @rvansa. For readability we could wrap those
acquire/release methods with some "sweetened" methods, but I'd avoid that
as they hide the milpementaito new aer using.


On Tue, Aug 19, 2014 at 4:39 PM, Radim Vansa <notifications@github.com>
wrote:

> In
> persistence/leveldb/src/main/java/org/infinispan/persistence/leveldb/LevelDBStore.java:
>
> > @@ -49,13 +50,14 @@
> >     private DB db;
> >     private DB expiredDb;
> >     private InitializationContext ctx;
> > -
> > +   private Semaphore semaphore;
>
> I haven't used the fair version of semaphore (it's configurable in ctor
> param) because I want to keep the overhead as low as possible, and I don't
> expect the application to be really contending on the store when it is
> about to be stopped (or completely cleared).
>
> Regarding readability - OK, .writeLock().lock() might be more obvious than
> .acquire(Integer.MAX_VALUE), but as I've said before, I prefer the
> lightweight solution. Let's have some democracy (sh!), if @tristantarrant
> <https://github.com/tristantarrant> prefers rwlock as well, I will be
> outnumbered and have to rewrite that.
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/infinispan/infinispan/pull/2807/files#r16418131>.
>