lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cutt...@apache.org
Subject cvs commit: jakarta-lucene/src/java/org/apache/lucene/index SegmentsReader.java
Date Thu, 11 Oct 2001 22:44:23 GMT
cutting     01/10/11 15:44:23

  Modified:    src/java/org/apache/lucene/index SegmentsReader.java
  Log:
  Fixed potential race condition.
  
  Revision  Changes    Path
  1.2       +2 -2      jakarta-lucene/src/java/org/apache/lucene/index/SegmentsReader.java
  
  Index: SegmentsReader.java
  ===================================================================
  RCS file: /home/cvs/jakarta-lucene/src/java/org/apache/lucene/index/SegmentsReader.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- SegmentsReader.java	2001/09/18 16:29:54	1.1
  +++ SegmentsReader.java	2001/10/11 22:44:23	1.2
  @@ -77,7 +77,7 @@
       starts[readers.length] = maxDoc;
     }
   
  -  public final int numDocs() {
  +  public synchronized final int numDocs() {
       if (numDocs == -1) {			  // check cache
         int n = 0;				  // cache miss--recompute
         for (int i = 0; i < readers.length; i++)
  @@ -101,7 +101,7 @@
       return readers[i].isDeleted(n - starts[i]);	  // dispatch to segment reader
     }
   
  -  public final void delete(int n) throws IOException {
  +  public synchronized final void delete(int n) throws IOException {
       numDocs = -1;				  // invalidate cache
       int i = readerIndex(n);			  // find segment num
       readers[i].delete(n - starts[i]);		  // dispatch to segment reader
  
  
  

Mime
View raw message