6818464: TEST_BUG: java/util/Timer/KillThread.java failing intermittently
Reviewed-by: dholmes, alanb, forax
Contributed-by: gary.adams@oracle.com
--- a/jdk/test/java/util/Timer/KillThread.java Fri Nov 18 11:11:11 2011 -0800
+++ b/jdk/test/java/util/Timer/KillThread.java Sat Nov 19 19:55:19 2011 +0000
@@ -32,20 +32,25 @@
public class KillThread {
public static void main (String[] args) throws Exception {
+ final Thread[] tdThread = new Thread[1];
Timer t = new Timer();
// Start a mean event that kills the timer thread
t.schedule(new TimerTask() {
public void run() {
+ tdThread[0] = Thread.currentThread();
throw new ThreadDeath();
}
}, 0);
// Wait for mean event to do the deed and thread to die.
try {
- Thread.sleep(100);
+ do {
+ Thread.sleep(100);
+ } while(tdThread[0] == null);
} catch(InterruptedException e) {
}
+ tdThread[0].join();
// Try to start another event
try {