Rollerball
Rollerball

Reputation: 13108

Interrupts handling in java

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

Answers (1)

Thomas
Thomas

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 as ThreadGroup.interrupt.

There is no mention of external factors being able to interrupt a thread.

Upvotes: 2

Related Questions