• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Interrupted Exception

 
sun par
Ranch Hand
Posts: 257
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can anyone clarify when Interrupted exception is thrown in the case of wait method?
Thanks
sun par
 
Vin Kris
Ranch Hand
Posts: 154
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic