An InterruptedException
is thrown when the thread is blocked/waiting and it is interrupted by another thread (by means of Thread.interrupt
). Think of it as a request for immediate termination, that do not suffer the drawbacks of Thread.stop()
.
This way, even if you instruct a thread to sleep for several years, you are able to interrupt that thread.
The recommended practice is aborting whatever you are processing when a InterruptedException
is thrown.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With