On Mon, 30 Jan 2023 09:50:19 GMT, Alexey Ivanov <[email protected]> wrote:

>> I removed sleep from EDT case and not blocking EDT and guess sleep is now 
>> being done for non-EDT case...
>> If it is to be called from EDT then it should go to "if" block and not to 
>> "else" which is what I based my fix on..
>> 
>> Anyway, I appreciate your fix and will see to it..
>
> Yet having `sleep` is an indication of busy wait. You could've used 
> `CountDownLatch` in conjunction with `setState` to avoid `sleep` at all.
> 
>> I removed sleep from EDT case and not blocking EDT and guess sleep is now 
>> being done for non-EDT case...
> 
> Ah, right. But then if `cancel` is called on EDT, `done` is invoked before 
> `doInBackground` completes, isn't it?
> 
> If `cancel` is called from another thread, the main thread as in the test, it 
> doesn't return until `doInBackground` completes. With your test case and fix, 
> `cancel` blocks for 5 seconds.
> 
> Either way, the behaviour does not look right.

It seems the isDone method modification is causing a JCK test to fail and 
there's no spec for it to challenge JCK test, although logically it seems right 
that STATE should be DONE but for now, I have modified the fix which satisfies 
regression test and JCK both..

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

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

Reply via email to