lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Lamprecht <clampre...@gmail.com>
Subject Re: How do I unlock?
Date Tue, 11 Jan 2005 21:28:35 GMT
What about a shutdown hook?
  
Runtime.getRuntime().addShutdownHook(new Thread() {
    public void run() { /* whatever */ }
});

see also http://www.onjava.com/pub/a/onjava/2003/03/26/shutdownhook.html


On Tue, 11 Jan 2005 13:21:42 -0800, Doug Cutting <cutting@apache.org> wrote:
> Joseph Ottinger wrote:
> > As one for whom the question's come up recently, I'd say that locks need
> > to be terminated gracefully, instead. I've noticed a number of cases where
> > the locks get abandoned in exceptional conditions, which is almost exactly
> > what you don't want.
> 
> The problem is that this is hard to do from Java.  A typical approach is
> to put the process id in the lock file, then, if that process is dead,
> ignore the lock file.  But Java does not let one know process ids.  Java
> 1.4 provides a LockFile mechanism which should mostly solve this, but
> Lucene 1.4.3 does not yet require Java 1.4 and hence cannot use that
> feature.  Lucene 2.0 is likely to require Java 1.4 and should be able to
> do a better job of automatically unlocking indexes when processes die.
> 
> Doug
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: lucene-user-help@jakarta.apache.org
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-user-help@jakarta.apache.org


Mime
View raw message