Who interrupts my thread?

后端 未结 3 1078
一生所求
一生所求 2020-12-17 16:42

I understand what an InterruptedException does and why it is thrown. However in my application I get it when waiting for SwingUtilities.invokeAndWait() on a thr

3条回答
  •  余生分开走
    2020-12-17 17:30

    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.

提交回复
热议问题