RFR: 8081474: SwingWorker calls 'done' before the 'doInBackground' is finished [v7]
Alexey Ivanov
aivanov at openjdk.org
Tue Jan 31 14:51:17 UTC 2023
On Tue, 31 Jan 2023 14:39:34 GMT, Prasanta Sadhukhan <psadhukhan at openjdk.org> wrote:
>> test/jdk/javax/swing/SwingWorker/TestDoneBeforeDoInBackground.java line 87:
>>
>>> 85: throw new RuntimeException("doInBackground is finished " +
>>> 86: " but State is not DONE");
>>> 87: }
>>
>> I think you should wait for cleanup to finish and ensure that `doInBackground` is set to `true` and the state is `DONE`.
>>
>> If you don't wait until cleanup wait completes, the test does not test anything because jtreg will shutdown the JVM as soon main thread exists, which will happen before `done` gets called.
>
> Dont think so...If `doInBackground `is true it should mean cleanup is done as `doInBackground ` is false by default
That's the thing. If `cancel` doesn't wait until `doInBackground` completes, which *it shouldn't do*, then `cancel` returns quickly. Therefore the main thread reaches this condition before the “cleanup” in `doInBackground` finishes, as such the test should always fail.
Do I miss anything?
-------------
PR: https://git.openjdk.org/jdk/pull/11940
More information about the client-libs-dev
mailing list