Meaningless Drivel is fun!
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Interrupted Exception Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Interrupted Exception" Watch "Interrupted Exception" New topic

Interrupted Exception

sun par
Ranch Hand

Joined: Oct 03, 2002
Posts: 257
Can anyone clarify when Interrupted exception is thrown in the case of wait method?
sun par

Sunita<br />SCJP 1.4
Vin Kris
Ranch Hand

Joined: Jun 17, 2002
Posts: 154
This is what the java documentation sez -
Thrown when a thread is waiting, sleeping, or otherwise paused for a long time and another thread interrupts it using the interrupt method in class Thread.
For example, consider a Scheduler that performs a job periodically. The scheduler waits from one schedule time to the next, performs the action and again waits. Say, This scheduler has to be stopped. The interrupt() method could be invoked on this thread object and the catch(InterruptedException) block can exit from the run() method.
I agree. Here's the link:
subject: Interrupted Exception
It's not a secret anymore!