lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From uschind...@apache.org
Subject svn commit: r1210276 - in /lucene/dev/branches/lucene3606/lucene/src/java/org/apache/lucene/index: DirectoryReader.java IndexReader.java SegmentReader.java
Date Sun, 04 Dec 2011 23:29:23 GMT
Author: uschindler
Date: Sun Dec  4 23:29:23 2011
New Revision: 1210276

URL: http://svn.apache.org/viewvc?rev=1210276&view=rev
Log:
LUCENE-3606: Remove IR.clone(readOnly)

Modified:
    lucene/dev/branches/lucene3606/lucene/src/java/org/apache/lucene/index/DirectoryReader.java
    lucene/dev/branches/lucene3606/lucene/src/java/org/apache/lucene/index/IndexReader.java
    lucene/dev/branches/lucene3606/lucene/src/java/org/apache/lucene/index/SegmentReader.java

Modified: lucene/dev/branches/lucene3606/lucene/src/java/org/apache/lucene/index/DirectoryReader.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3606/lucene/src/java/org/apache/lucene/index/DirectoryReader.java?rev=1210276&r1=1210275&r2=1210276&view=diff
==============================================================================
--- lucene/dev/branches/lucene3606/lucene/src/java/org/apache/lucene/index/DirectoryReader.java
(original)
+++ lucene/dev/branches/lucene3606/lucene/src/java/org/apache/lucene/index/DirectoryReader.java
Sun Dec  4 23:29:23 2011
@@ -305,26 +305,17 @@ class DirectoryReader extends IndexReade
   @Override
   public final synchronized Object clone() {
     try {
-      return clone(true);
+      DirectoryReader newReader = doOpenIfChanged((SegmentInfos) segmentInfos.clone(), true,
true);
+      newReader.writer = writer;
+      newReader.hasDeletions = hasDeletions;
+      assert newReader.readerFinishedListeners != null;
+      return newReader;
     } catch (Exception ex) {
       throw new RuntimeException(ex);
     }
   }
 
   @Override
-  public final synchronized IndexReader clone(boolean openReadOnly) throws CorruptIndexException,
IOException {
-    assert openReadOnly;
-    // doOpenIfChanged calls ensureOpen
-    DirectoryReader newReader = doOpenIfChanged((SegmentInfos) segmentInfos.clone(), true,
openReadOnly);
-
-    newReader.writer = writer;
-    newReader.hasDeletions = hasDeletions;
-    assert newReader.readerFinishedListeners != null;
-
-    return newReader;
-  }
-
-  @Override
   protected final IndexReader doOpenIfChanged() throws CorruptIndexException, IOException
{
     return doOpenIfChanged(true, null);
   }

Modified: lucene/dev/branches/lucene3606/lucene/src/java/org/apache/lucene/index/IndexReader.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3606/lucene/src/java/org/apache/lucene/index/IndexReader.java?rev=1210276&r1=1210275&r2=1210276&view=diff
==============================================================================
--- lucene/dev/branches/lucene3606/lucene/src/java/org/apache/lucene/index/IndexReader.java
(original)
+++ lucene/dev/branches/lucene3606/lucene/src/java/org/apache/lucene/index/IndexReader.java
Sun Dec  4 23:29:23 2011
@@ -653,16 +653,6 @@ public abstract class IndexReader implem
   public synchronized Object clone() {
     throw new UnsupportedOperationException("This reader does not implement clone()");
   }
-  
-  /**
-   * Clones the IndexReader and optionally changes readOnly.  A readOnly 
-   * reader cannot open a writeable reader.  
-   * @throws CorruptIndexException if the index is corrupt
-   * @throws IOException if there is a low-level IO error
-   */
-  public synchronized IndexReader clone(boolean openReadOnly) throws CorruptIndexException,
IOException {
-    throw new UnsupportedOperationException("This reader does not implement clone()");
-  }
 
   /** 
    * Returns the directory associated with this index.  The Default 

Modified: lucene/dev/branches/lucene3606/lucene/src/java/org/apache/lucene/index/SegmentReader.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3606/lucene/src/java/org/apache/lucene/index/SegmentReader.java?rev=1210276&r1=1210275&r2=1210276&view=diff
==============================================================================
--- lucene/dev/branches/lucene3606/lucene/src/java/org/apache/lucene/index/SegmentReader.java
(original)
+++ lucene/dev/branches/lucene3606/lucene/src/java/org/apache/lucene/index/SegmentReader.java
Sun Dec  4 23:29:23 2011
@@ -187,8 +187,8 @@ public class SegmentReader extends Index
     }
   }
 
-  @Override
-  public final synchronized IndexReader clone(boolean openReadOnly) throws CorruptIndexException,
IOException {
+  // nocommit: is this needed anymore by IndexWriter?
+  final synchronized IndexReader clone(boolean openReadOnly) throws CorruptIndexException,
IOException {
     return reopenSegment(si, true, openReadOnly);
   }
 



Mime
View raw message