[BUILD] Remember to use AtomicReader.addCoreClosedListener when upgrading to Lucene 4.9.

This commit is contained in:
Adrien Grand 2014-05-28 09:35:00 +02:00
parent e97a381db2
commit be29138962
1 changed files with 5 additions and 0 deletions

View File

@ -21,6 +21,7 @@ package org.elasticsearch.common.lucene;
import org.apache.lucene.index.AtomicReader;
import org.apache.lucene.index.FilterAtomicReader;
import org.apache.lucene.index.SegmentReader;
import org.apache.lucene.util.Version;
import org.elasticsearch.ElasticsearchIllegalStateException;
import org.elasticsearch.common.Nullable;
@ -44,6 +45,10 @@ public class SegmentReaderUtils {
return internalSegmentReader(reader, false);
}
static {
assert Version.LUCENE_48.onOrAfter(Lucene.VERSION) : "Use AtomicReader.addCoreClosedListener instead of trying to unwrap the atomic reader: https://issues.apache.org/jira/browse/LUCENE-5701";
}
public static boolean registerCoreListener(AtomicReader reader, SegmentReader.CoreClosedListener listener) {
SegmentReader segReader = SegmentReaderUtils.segmentReaderOrNull(reader);
if (segReader != null) {