mirror of https://github.com/apache/lucene.git
LUCENE-3606: Remove IR.clone(readOnly)
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/branches/lucene3606@1210276 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
e1918d8e9c
commit
5586ca1912
|
@ -305,25 +305,16 @@ class DirectoryReader extends IndexReader implements Cloneable {
|
|||
@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);
|
||||
|
|
|
@ -653,16 +653,6 @@ public abstract class IndexReader implements Cloneable,Closeable {
|
|||
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
|
||||
|
|
|
@ -187,8 +187,8 @@ public class SegmentReader extends IndexReader implements Cloneable {
|
|||
}
|
||||
}
|
||||
|
||||
@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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue