Skip to content

Apache Lucene open-source search software

LUCENE-2819: don't report problems about threads that were spawned before our tests (such as eclipse test-runner threads)

Robert Muir5ee58ef139ff
diff --git a/lucene/src/test/org/apache/lucene/util/LuceneTestCase.java b/lucene/src/test/org/apache/lucene/util/LuceneTestCase.java
index 6dca8e97f01..e4a687b573e 100644
--- a/lucene/src/test/org/apache/lucene/util/LuceneTestCase.java
+++ b/lucene/src/test/org/apache/lucene/util/LuceneTestCase.java
@@ -522,6 +522,13 @@ public abstract class LuceneTestCase extends Assert {
// 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.