carrotsearch/randomizedtesting — Issue #7: Allow thread lingering on method/class before leak detection
Author: dweiss
Created: 2011-11-01 08:35:00+00:00
State: open

In practice this turns out to be really useful because many classes simply leave children threads to die without joining their lifecycle. This is the case with java.util.Timer, EhCache (which uses Timers), Executors framework... you name it. Currently all these pose a problem because one needs to manually wait a bit or join the children threads (if possible).

A partial solution is to allow some lingering time in which all children threads should terminate. I'm thinking:

@ThreadLeakDetection(linger = 0, failIfLeakDetected = true)

This would apply per-class or per-test. The above would also be the default.