Skip to content

Apache Lucene open-source search software

Merge r1052424 through r1054503 into realtime branch

Michael Buschc8183def268e
diff --cc lucene/src/test/org/apache/lucene/util/LuceneTestCase.java
index 7bbd4a0f86c,d40e703f8e9..f9da47b86b9
--- a/lucene/src/test/org/apache/lucene/util/LuceneTestCase.java
+++ b/lucene/src/test/org/apache/lucene/util/LuceneTestCase.java
@@@ -550,7 -521,14 +550,14 @@@ public abstract class LuceneTestCase ex
private final static int THREAD_STOP_GRACE_MSEC = 1000;
// jvm-wide list of 'rogue threads' we found, so they only get reported once.
private final static IdentityHashMap<Thread,Boolean> rogueThreads = new IdentityHashMap<Thread,Boolean>();
-
+
+ static {
+ // just a hack for things like eclipse test-runner threads
+ for (Thread t : Thread.getAllStackTraces().keySet()) {
+ rogueThreads.put(t, true);
+ }
+ }
+
/**
* Looks for leftover running threads, trying to kill them off,
* so they don't fail future tests.
@@@ -568,15 -546,13 +575,13 @@@
stillRunning = new Thread[stillRunning.length*2];
threadCount = Thread.enumerate(stillRunning);
}
-
+
for (int i = 0; i < threadCount; i++) {
Thread t = stillRunning[i];
-
- if (t.isAlive() &&
- !rogueThreads.containsKey(t) &&
+
+ if (t.isAlive() &&
+ !rogueThreads.containsKey(t) &&
- t != Thread.currentThread() &&
- // TODO: TimeLimitingCollector starts a thread statically.... WTF?!
- !t.getName().equals("TimeLimitedCollector timer thread")) {
+ t != Thread.currentThread()) {
System.err.println("WARNING: " + context + " left thread running: " + t);
rogueThreads.put(t, true);
rogueCount++;