LUCENE-6271: fix test to fail faster

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/branches/lucene6271@1670508 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael McCandless 2015-03-31 22:44:11 +00:00
parent 4a1d1c7c31
commit dd0c69cac5
1 changed files with 5 additions and 5 deletions

View File

@ -332,7 +332,7 @@ public abstract class ThreadedIndexingAndSearchingTestCase extends LuceneTestCas
if (VERBOSE) { if (VERBOSE) {
System.out.println(Thread.currentThread().getName() + ": launch search thread"); System.out.println(Thread.currentThread().getName() + ": launch search thread");
} }
while (System.currentTimeMillis() < stopTimeMS) { while (System.currentTimeMillis() < stopTimeMS && !failed.get()) {
try { try {
final IndexSearcher s = getCurrentSearcher(); final IndexSearcher s = getCurrentSearcher();
try { try {
@ -403,8 +403,8 @@ public abstract class ThreadedIndexingAndSearchingTestCase extends LuceneTestCas
searchThreads[thread].start(); searchThreads[thread].start();
} }
for(int thread=0;thread<searchThreads.length;thread++) { for(Thread thread : searchThreads) {
searchThreads[thread].join(); thread.join();
} }
if (VERBOSE) { if (VERBOSE) {
@ -535,8 +535,8 @@ public abstract class ThreadedIndexingAndSearchingTestCase extends LuceneTestCas
System.out.println("TEST: all searching done [" + (System.currentTimeMillis()-t0) + " ms]"); System.out.println("TEST: all searching done [" + (System.currentTimeMillis()-t0) + " ms]");
} }
for(int thread=0;thread<indexThreads.length;thread++) { for(Thread thread : indexThreads) {
indexThreads[thread].join(); thread.join();
} }
if (VERBOSE) { if (VERBOSE) {