lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vasu shah <vasusha...@yahoo.com>
Subject Re: IndexReader / IndexWriter Synchronization
Date Tue, 25 Jul 2006 15:45:08 GMT
Thanks Mike for the reply. I will look into Lucene in Action.
   
  I am not very good at threading. So I was looking if there is any api class (even in nightly
builds) on top of the IndexReader/IndexWriter that takes care of concurrency rules. 
   
  Every developer must be facing this problem of concurrency while programming.
   
  Thanks again.
  -Vasu

Michael McCandless <lucene@mikemccandless.com> wrote:
  
> If I use IndexReader and IndexWriter class for inserts/updates, then I need to handle
the threading issues myself. Is there any other class (even in nightly build) that I can use
without having to take care of synchronization.

All this means is your code must ensure only one "writer" (IndexWriter
adding docs or IndexReader removing docs) is open at a time. If you
fail to do so, then the second "writer" you try to create will throw a
"Lock obtain timed out" IOException.

Otherwise these classes are fully thread safe.

The performance caveat in IndexModifier (that you should batch your
deletes and batch your adds) still applies, because you will need to
open/close an IndexReader for the former and an IndexWriter for the
latter.

The Lucene in Action book does a great job describing these
concurrency rules.

Also, you should first test IndexModifier to be really sure its
performance is not sufficient for your needs.

Mike

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



 			
---------------------------------
See the all-new, redesigned Yahoo.com.  Check it out.
Mime
  • Unnamed multipart/alternative (inline, 8-Bit, 0 bytes)
View raw message