mirror of https://github.com/apache/lucene.git
merge unrelated nightly test bugfixes from LUCENE-6271 branch
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1670529 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
33fc7b5046
commit
86bea1d123
|
@ -28,6 +28,7 @@ import java.util.HashSet;
|
|||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
@ -957,12 +958,18 @@ public class TestLRUQueryCache extends LuceneTestCase {
|
|||
BadQuery query = new BadQuery();
|
||||
searcher.count(query);
|
||||
query.i[0] += 1; // change the hashCode!
|
||||
|
||||
try {
|
||||
// trigger an eviction
|
||||
searcher.count(new MatchAllDocsQuery());
|
||||
fail();
|
||||
} catch (ConcurrentModificationException e) {
|
||||
// expected
|
||||
} catch (RuntimeException e) {
|
||||
// expected: wrapped when executor is in use
|
||||
Throwable cause = e.getCause();
|
||||
assertTrue(cause instanceof ExecutionException);
|
||||
assertTrue(cause.getCause() instanceof ConcurrentModificationException);
|
||||
}
|
||||
|
||||
IOUtils.close(w, reader, dir);
|
||||
|
|
|
@ -309,7 +309,6 @@ public abstract class ThreadedIndexingAndSearchingTestCase extends LuceneTestCas
|
|||
doAfterIndexingThreadDone();
|
||||
}
|
||||
};
|
||||
threads[thread].setDaemon(true);
|
||||
threads[thread].start();
|
||||
}
|
||||
|
||||
|
@ -332,7 +331,7 @@ public abstract class ThreadedIndexingAndSearchingTestCase extends LuceneTestCas
|
|||
if (VERBOSE) {
|
||||
System.out.println(Thread.currentThread().getName() + ": launch search thread");
|
||||
}
|
||||
while (System.currentTimeMillis() < stopTimeMS) {
|
||||
while (System.currentTimeMillis() < stopTimeMS && !failed.get()) {
|
||||
try {
|
||||
final IndexSearcher s = getCurrentSearcher();
|
||||
try {
|
||||
|
@ -399,12 +398,11 @@ public abstract class ThreadedIndexingAndSearchingTestCase extends LuceneTestCas
|
|||
}
|
||||
}
|
||||
};
|
||||
searchThreads[thread].setDaemon(true);
|
||||
searchThreads[thread].start();
|
||||
}
|
||||
|
||||
for(int thread=0;thread<searchThreads.length;thread++) {
|
||||
searchThreads[thread].join();
|
||||
for(Thread thread : searchThreads) {
|
||||
thread.join();
|
||||
}
|
||||
|
||||
if (VERBOSE) {
|
||||
|
@ -535,8 +533,8 @@ public abstract class ThreadedIndexingAndSearchingTestCase extends LuceneTestCas
|
|||
System.out.println("TEST: all searching done [" + (System.currentTimeMillis()-t0) + " ms]");
|
||||
}
|
||||
|
||||
for(int thread=0;thread<indexThreads.length;thread++) {
|
||||
indexThreads[thread].join();
|
||||
for(Thread thread : indexThreads) {
|
||||
thread.join();
|
||||
}
|
||||
|
||||
if (VERBOSE) {
|
||||
|
|
|
@ -146,7 +146,8 @@ public class LineFileDocs implements Closeable {
|
|||
}
|
||||
|
||||
public synchronized void reset(Random random) throws IOException {
|
||||
close();
|
||||
reader.close();
|
||||
reader = null;
|
||||
open(random);
|
||||
id.set(0);
|
||||
}
|
||||
|
@ -215,7 +216,8 @@ public class LineFileDocs implements Closeable {
|
|||
if (LuceneTestCase.VERBOSE) {
|
||||
System.out.println("TEST: LineFileDocs: now rewind file...");
|
||||
}
|
||||
close();
|
||||
reader.close();
|
||||
reader = null;
|
||||
open(null);
|
||||
line = reader.readLine();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue