提交 ac166ec1 编写于 作者: A alanb

6818464: TEST_BUG: java/util/Timer/KillThread.java failing intermittently

Reviewed-by: dholmes, alanb, forax
Contributed-by: gary.adams@oracle.com
上级 16ad8cc6
...@@ -32,20 +32,25 @@ import java.util.*; ...@@ -32,20 +32,25 @@ import java.util.*;
public class KillThread { public class KillThread {
public static void main (String[] args) throws Exception { public static void main (String[] args) throws Exception {
final Thread[] tdThread = new Thread[1];
Timer t = new Timer(); Timer t = new Timer();
// Start a mean event that kills the timer thread // Start a mean event that kills the timer thread
t.schedule(new TimerTask() { t.schedule(new TimerTask() {
public void run() { public void run() {
tdThread[0] = Thread.currentThread();
throw new ThreadDeath(); throw new ThreadDeath();
} }
}, 0); }, 0);
// Wait for mean event to do the deed and thread to die. // Wait for mean event to do the deed and thread to die.
try { try {
do {
Thread.sleep(100); Thread.sleep(100);
} while(tdThread[0] == null);
} catch(InterruptedException e) { } catch(InterruptedException e) {
} }
tdThread[0].join();
// Try to start another event // Try to start another event
try { try {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册