Is that a part of some regular process? as in the tomcat shutdown? if it is, could you pass a shutdown signal to the search daemon/service and then get it to close the already opened writers. Also if its the service that causes the exception, add a writer.close statement to the finally block (add that if that's not already in place). That should solve the problem.
-- Anshum Gupta Naukri Labs! http://ai-cafe.blogspot.com The facts expressed here belong to everybody, the opinions to me. The distinction is yours to draw............ On Mon, Nov 2, 2009 at 3:50 PM, Chris Bamford <chris.bamf...@scalix.com>wrote: > Hi Anshum, > > Yes there is a reply, but it is Solr specific :-) > I understand that I can catch the exception, but then what can I do about > it when it occurs? In my case I am pretty sure that the 'write.lock' file > is stale - most probably left from the last time Tomcat shut down - so I > want to force it to be opened. How can I do that? Am I obliged to locate > the file and remove it myself before attempting to repeat the open() - or is > there something in the API to help? > > Thanks > > - Chris > > ----- Original Message ----- > From: Anshum <ansh...@gmail.com> > Sent: Mon, 11/2/2009 10:08am > To: java-user@lucene.apache.org > Subject: Re: LockObtainFailedException > > Hi Chris, > > Isn't there a reply @ the older thread? > In case there isn't, this is generally observed when an indexwriter is not > closed properly i.e. just not closed. > The lock is created on opening the indexwriter to maintain the sanity of > the > index. This lock gets removed on closing writer.close(). In case of > exceptions, when the indexwriter.close() is not closed, the subsequent call > to an index operation (opening a writer) would result in a > lockobtainfailedexception. > Try using a finally block to handle such cases. > > -- > Anshum Gupta > Naukri Labs! > http://ai-cafe.blogspot.com > > The facts expressed here belong to everybody, the opinions to me. The > distinction is yours to draw............ > > > On Mon, Nov 2, 2009 at 3:27 PM, Chris Bamford <chris.bamf...@scalix.com > >wrote: > > > Hi, > > > > I was researching LockObtainFailedExceptions and came across this thread. > > I > > don't use Solr, just regular Lucene deployed via Tomcat - but I have > > started getting these exceptions which coincides with our recent > > upgrade from 2.0.0 to 2.4.0. > > I have found that just removing the lock file > > seems to clear up the problem, but I was hoping for (a) a better > > understanding of why they might occur in the first place and (b) some > > thoughts on how I might deal with them programatically. > > > > Thanks for any ideas / pointers, > > > > - Chris > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org > For additional commands, e-mail: java-user-h...@lucene.apache.org > >