Can anyone clarify when Interrupted exception is thrown in the case of wait method? Thanks sun par
Sunita<br />SCJP 1.4
posted 13 years ago
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.