【发布时间】:2012-03-28 05:31:51
【问题描述】:
作为标题。
public static void main(String[] args) throws InterruptedException {
Thread thread = new Thread(new Runnable() {
@Override
public void run() {
try {
TimeUnit.SECONDS.sleep(2);
} catch (InterruptedException e) {
e.printStackTrace();
System.out.println(Thread.currentThread().isInterrupted()); //print false, who reset the interrupt?
}
}
});
thread.start();
TimeUnit.SECONDS.sleep(1);
thread.interrupt();
}
捕获“InterruptedException”后,为什么“Thread.currentThread().isInterrupted()”的值为false?
【问题讨论】:
标签: java multithreading interrupt