# HG changeset patch # User alanb # Date 1321732519 0 # Node ID 0e9667605c60d506092f18dfc242b9d4bc215823 # Parent 41ce4af91010d259e95b5538ef25eb262bcf1234 6818464: TEST_BUG: java/util/Timer/KillThread.java failing intermittently Reviewed-by: dholmes, alanb, forax Contributed-by: gary.adams@oracle.com diff -r 41ce4af91010 -r 0e9667605c60 jdk/test/java/util/Timer/KillThread.java --- 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 {