mirror of https://github.com/apache/lucene.git
add getter for the current searching generation
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1719986 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
f81f939b54
commit
8cc1f0e50f
|
@ -181,7 +181,7 @@ public class ControlledRealTimeReopenThread<T> extends Thread implements Closeab
|
|||
if (maxMS < 0) {
|
||||
wait();
|
||||
} else {
|
||||
long msLeft = (startMS + maxMS) - (System.nanoTime())/1000000;
|
||||
long msLeft = (startMS + maxMS) - System.nanoTime()/1000000;
|
||||
if (msLeft <= 0) {
|
||||
return false;
|
||||
} else {
|
||||
|
@ -248,4 +248,9 @@ public class ControlledRealTimeReopenThread<T> extends Thread implements Closeab
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Returns which {@code generation} the current searcher is guaranteed to include. */
|
||||
public long getSearchingGen() {
|
||||
return searchingGen;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,7 +24,6 @@ import java.util.concurrent.CountDownLatch;
|
|||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import org.apache.lucene.analysis.Analyzer;
|
||||
import org.apache.lucene.analysis.MockAnalyzer;
|
||||
import org.apache.lucene.document.Document;
|
||||
import org.apache.lucene.document.Field;
|
||||
|
@ -103,6 +102,7 @@ public class TestControlledRealTimeReopenThread extends ThreadedIndexingAndSearc
|
|||
System.out.println(Thread.currentThread().getName() + ": nrt: verify " + id);
|
||||
}
|
||||
nrtDeletesThread.waitForGeneration(gen);
|
||||
assertTrue(gen <= nrtDeletesThread.getSearchingGen());
|
||||
final IndexSearcher s = nrtDeletes.acquire();
|
||||
if (VERBOSE) {
|
||||
System.out.println(Thread.currentThread().getName() + ": nrt: got searcher=" + s);
|
||||
|
@ -126,6 +126,7 @@ public class TestControlledRealTimeReopenThread extends ThreadedIndexingAndSearc
|
|||
System.out.println(Thread.currentThread().getName() + ": nrt: verify " + id);
|
||||
}
|
||||
nrtNoDeletesThread.waitForGeneration(gen);
|
||||
assertTrue(gen <= nrtNoDeletesThread.getSearchingGen());
|
||||
final IndexSearcher s = nrtNoDeletes.acquire();
|
||||
if (VERBOSE) {
|
||||
System.out.println(Thread.currentThread().getName() + ": nrt: got searcher=" + s);
|
||||
|
@ -149,6 +150,7 @@ public class TestControlledRealTimeReopenThread extends ThreadedIndexingAndSearc
|
|||
System.out.println(Thread.currentThread().getName() + ": nrt: verify " + id);
|
||||
}
|
||||
nrtNoDeletesThread.waitForGeneration(gen);
|
||||
assertTrue(gen <= nrtNoDeletesThread.getSearchingGen());
|
||||
final IndexSearcher s = nrtNoDeletes.acquire();
|
||||
if (VERBOSE) {
|
||||
System.out.println(Thread.currentThread().getName() + ": nrt: got searcher=" + s);
|
||||
|
@ -171,6 +173,7 @@ public class TestControlledRealTimeReopenThread extends ThreadedIndexingAndSearc
|
|||
System.out.println(Thread.currentThread().getName() + ": nrt: verify " + id);
|
||||
}
|
||||
nrtDeletesThread.waitForGeneration(gen);
|
||||
assertTrue(gen <= nrtDeletesThread.getSearchingGen());
|
||||
final IndexSearcher s = nrtDeletes.acquire();
|
||||
if (VERBOSE) {
|
||||
System.out.println(Thread.currentThread().getName() + ": nrt: got searcher=" + s);
|
||||
|
@ -193,6 +196,7 @@ public class TestControlledRealTimeReopenThread extends ThreadedIndexingAndSearc
|
|||
System.out.println(Thread.currentThread().getName() + ": nrt: verify del " + id);
|
||||
}
|
||||
nrtDeletesThread.waitForGeneration(gen);
|
||||
assertTrue(gen <= nrtDeletesThread.getSearchingGen());
|
||||
final IndexSearcher s = nrtDeletes.acquire();
|
||||
if (VERBOSE) {
|
||||
System.out.println(Thread.currentThread().getName() + ": nrt: got searcher=" + s);
|
||||
|
|
Loading…
Reference in New Issue