I want my thread to handle interruption, but I can't catch InterruptedException because it is a checked exception
I have a thread in Java which calls t.interrupt(); making t (a different thread) be interrupted. I want the "t" thread to then catch an InterruptedException but Eclipse won't let me put an InterruptedException in saying it's not thrown in the try body. How can I get the InterruptedException to be called? Am I using t.interrupt() wrong? While the other answers are correct, a fuller explanation is appropriate. A thread can be safely interrupted (in the general sense of the word) only at specific points in its execution. In particular, it can be interrupted safely when it has issued a wait() call