当我们谈论java中的中断时,例如Thread.sleep(1000);
,只有在调用t.interrupt()
时,它才可能抛出异常还是操作系统发送的潜在中断?
最佳答案
来自Java 7 language specification :
Interruption actions occur upon invocation of
Thread.interrupt
, as well as methods defined to invoke it in turn, such asThreadGroup.interrupt
.
没有提到外部因素能够中断线程。
关于java - java中的中断处理,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16870610/