RFR: 8081474: SwingWorker calls 'done' before the 'doInBackground' is finished [v3]

Alexey Ivanov aivanov at openjdk.org
Sun Jan 29 15:17:17 UTC 2023


On Fri, 27 Jan 2023 05:05:37 GMT, Prasanta Sadhukhan <psadhukhan at openjdk.org> wrote:

> Should we just update the spec citing it's not necessary to wait for `doInBackground()` to finish before `done()` is called?

It is also an option.

All the suggested approaches set the state to `DONE` before `done` is called now. Yet the Workflow states the following: “After the `doInBackground` method is finished the `done` method is executed. Then `SwingWorker` notifies any `PropertyChangeListeners` about the state property change to `StateValue.DONE`.”

However, the last sentence may not have been guaranteed before either but it was likely satisfied as `doneEDT` was called before `setState(StateValue.DONE)`. So, `done` had likely been executed before `PropertyChangeListener` was notified.

Hence, a small update to the spec may still be required whatever option we choose.

-------------

PR: https://git.openjdk.org/jdk/pull/11940



More information about the client-libs-dev mailing list