I am in a situation where I catch anInterruptedException
but I put a breakpoint at the beginning of the Thread.interrupt()
method and there is no hit.
What else can cause InterruptedException
to be thrown? Note that I encounter this problem only on Windows, the same code runs fine on Linux. As the interrupt method delegates to a native call interrupt0, I guess it comes from there. But how can I investigate further ?
Thanks
EDIT:
I found my problem. It was also my misunderstanding of the interrupt mechanism. Thread.interrupt is called indeed. What bit me is that it is called long before I start the wait(). But as the thread has the interrupt flag activated, the first call to wait throws the exception immediately.
In my case, it was log4j who set the interrupted flag when it tries to create a NonBlockingSocketAppender on an invalid address. Even weird is that it interrupts the thread it is currently running on...