lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael McCandless" <>
Subject Re: - lock improvement suggestion
Date Fri, 09 Nov 2007 15:50:12 GMT

I agree, we should not ignore the return value here.  I think throwing an
exception if it returns false is the right thing to do?  Though, if it's
a checked exception, that's not a backwards compatible change...


"Nikolay Diakov" <> wrote:
> I have briefly reviewed the SimpleFSLock of Lucene 2.1 and 2.2. I see 
> that the lock release mechanism does not check the return value of
> delete:
>    public void release() {
>      lockFile.delete();
>    }
> On most linux-es this can never return false, however under some windows 
> FS if someone (a virus scanner) touches the file at the proper 
> (improper) time, one may get a delete failure and get a false value. In 
> the original code this means that the directory stays locked forever 
> (unless someone does double unlocking or until a clearLock from the lock 
> factory). For diagnosting purposes, it may be a good idea to throw an 
> exception in that case. Alternatively, release() may return a boolean up 
> the chain, however this may require more changes in the code using the 
> release(). Just a suggestion.
> Cheers,
>    Nikolay
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message