SwingWorker: when exactly is called done method?

后端 未结 6 2053
遇见更好的自我
遇见更好的自我 2020-12-05 10:50

Javadoc of the done() method of SwingWorker:

Executed on the Event Dispatch Thread after the doInBackground method is

6条回答
  •  自闭症患者
    2020-12-05 11:11

    From the Java docs: cancel(boolean mayInterruptIfRunning) "mayInterruptIfRunning - true if the thread executing this task should be interrupted; otherwise, in-progress tasks are allowed to complete"

    If you call cancel(true) instead of cancel(false) that seems to behave as you are expecting.

    I have not seen done() called off the EDT using EventQueue.isDispatchThread()

提交回复
热议问题