RFR: 8081474: SwingWorker calls 'done' before the 'doInBackground' is finished [v21]
Alexey Ivanov
aivanov at openjdk.org
Thu Feb 16 21:51:47 UTC 2023
On Thu, 16 Feb 2023 21:19:59 GMT, Sergey Bylokhov <serb at openjdk.org> wrote:
> I think the previous iteration of the fix was not run the doneEDT if the setState throws an exception, while the current version, and initial code always run it.
It depends…
If you change the order of the `doneEDT` and state, the listener throws the exception (as expected to fail the test) — then `done` isn't run because of the problem I just described above. It's an inherent problem in the implementation of `SwingWorker`. If you revert to the order of the calls in the latest revision and throw an exception from `done`, then listener for `DONE` state is not called.
It's a different bug which exists *with and without* the fix we're currently discussing.
I can repeat: I have a test which demonstrates the problem that you see now. The test reproduces the problem on any current build of Java (okay, I tested 17, 19 and 21). I will submit a new bug for it.
-------------
PR: https://git.openjdk.org/jdk/pull/11940
More information about the client-libs-dev
mailing list