lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Harwood <>
Subject Re: Thread safety
Date Fri, 21 Jun 2002 20:16:41 GMT
Thanks for the info on write.lock Otis,

>>If that is so, should there not be 'N' at delete/delete intersection?
I'm using the same IndexReader so, "no":
   public synchronized final void delete(int docNum)

>>The same goes for write/write intersection.  That should then be an 'N'
>>as well, no? 
Again, if using the same object (IndexWriter) there is some synchronization in 
the Lucene code to handle this:

  public final void addDocument(Document doc) throws IOException {
    DocumentWriter dw =
      new DocumentWriter(ramDirectory, analyzer, maxFieldLength);
    String segmentName = newSegmentName();
    dw.addDocument(segmentName, doc);
    synchronized (this) {
      segmentInfos.addElement(new SegmentInfo(segmentName, 1, ramDirectory));

I ran several concurrent threads in the test rig I originally posted without 
problems - looks like Lucene was handling these situations.

>>I'd hate to have a misleading and incorrect FAQ entry there.
Me too. Maybe the FAQ entry should have a footnote to explicitly state that 
the same reader/writer objects are being used by all threads.


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

View raw message