Who interrupts my thread?

后端 未结 3 1073
一生所求
一生所求 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:24

    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.

提交回复
热议问题