lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From John Wang <>
Subject lucene file locking question
Date Fri, 12 Nov 2004 02:21:55 GMT
Hi folks:

      My application builds a super-index around the lucene index,
e.g. stores some additional information outside of lucene.

       I am using my own locking outside of the lucene index via
FileLock object in the jdk1.4 nio package.

       My code does the following:

FileLock lock=null;

        indexing into lucene;

        indexing additional information;


          commit lucene index by closing the IndexWriter instance.
        if (lock!=null){

Now here is the weird thing, say I terminate the process in the middle
of indexing, and run the program again, I would get a "Lock obtain
time out" exception, as long as you delete the stale lock file, the
index remains uncorrupted.

However, if I turn lucene file lock off since I have a lock outside it anyways, 
(by doing: 

and do the same thing. Instead I get an unrecoverable corrupted index.

Does lucene lock really guarentee index integrity under this kind of
abuse or am I just getting lucky?
If so, can someone shine some light on how?

Thanks in advance


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

View raw message