Who interrupts my thread? Who interrupts my thread? multithreading multithreading

Who interrupts my thread?


If possible, you could extend Thread and overwrite the interrupt() method for this thread to print a stacktrace or throw an unsupported operation exception.

You could also use the extended Thread class to store a reference to the interrupting thread and read it once you catch the interrupted exception.


In general, if you want to know who is doing something, attach a debugger, put a breakpoint, and there you go. No need for guessing if you can reproduce it!

In this case, you can put a breakpoint at Thread.interrupt(). If there are other threads that are being interrupted too (so you have "false positive" hits on the breakpoint), you could add a breakpoint condition (most IDE's allow you to do that easily), for example by checking the name of the thread.


There is something strange here.

From the javadoc of invokeAndWait, an InterruptedException is thrown

if we're interrupted while waiting for the event dispatching thread to finish excecuting doRun.run()

Have you tried to see if the code executed in the EDT sends any exception ? Or do the code in that EDT tries to modify some of this thread's variables (I know this term is not "orthodox" in java language, but I hope you see what I mean : any code implying synchronized, wait, join, ...