It would make me nervous to have Lucene insert that shutdown hook.
EG closing the IndexWriter could in general be a time-consuming
process. But if it's working for you, that's great. Though, if you
explicitly kill the JVM (eg kill -9) those shutdown hooks won't run.
You should use org.
Hi Michael
I had in fact preempted you and moved the delete lock code to a startup
function. However, I found a nice little optimization that seems to
force the writer to close when the process is manually killed. I added a
JVM shutdown hook (i.e. using Runtime.getRuntime().addShutdownHook(thi
OK, that sounds like a legitimate reason to forcibly remove the write
lock, but it would be better to do that only on startup of your
process rather than in every openIndex() call.
If ever you hit LockObtainFailedException in openIndex, even after
having deleted the write lock on startup,
Hi Mike
Thanks for the suggestions. I've implemented all of them. The main
reason why I manually deleted the lock file was that sometimes users
kill the server process manually or there is a hard reboot without any
warning. In such circumstances, Lucene leaves a lock file lying around
as it w
http://people.apache.org/~hossman/#threadhijack
Thread Hijacking on Mailing Lists
When starting a new discussion on a mailing list, please do not reply to
an existing message, instead start a fresh email. Even if you change the
subject line of your email, other mail headers still track which
On quickly looking through the code I think there are some serious
hazards that could lead to this exception.
First, in your openIndex code, if you hit a LockObtainFailedException
in trying to open your writer, you are forcefully removing the write
lock and then retrying. Yet, you also o