Is there a way to determine whether or not an index that was left locked
due to some improper system shutdown needs repair?

My code does the following as part of starting up and creating an
IndexWriter for an existing index that was created in a prior session:

>         if (IndexReader.isLocked(index.indexDirectory)) {
>             // ***** TODO add a test for a valid index, if possible
>             log.error("Forcibly unlocking the index directory for
> investigation " + investigation.getName() + ".  Ensure it is not
> corrupt!");
>             IndexReader.unlock(index.indexDirectory);
>         }


The occurrence of this condition indicates the system did not shutdown
cleanly in the prior run.  I'd like to know whether the index is valid
or not before blindly unlocking it.

Thanks for any help,

Chuck


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to