Reputation: 13108
When we are talking about interrupts in java, say, Thread.sleep(1000);
it might throw an exception only if it's been called t.interrupt()
or also for potential interruptions sent by the OS?
Upvotes: 2
Views: 86
Reputation: 181705
From the 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
.
There is no mention of external factors being able to interrupt a thread.
Upvotes: 2