On Wed, 16 Nov 2022 17:04:08 GMT, Phil Race <[email protected]> wrote:
>> test/jdk/java/awt/FontClass/DrawStringWithInfiniteXform.java line 90:
>>
>>> 88: timer.cancel();
>>> 89: }
>>> 90: System.out.println("Test passed");
>>
>> It seems timer.cancel() says "Terminates this timer, discarding any
>> currently scheduled tasks." so it might disregard the "done" check been done
>> in ScheduleTask resulting in false positive...
>> Should we do Thread.yield() instead?
>>
>> Also, this test has many coding violations like l70, l79 where no space
>> between operators,variables...
>
>> It seems timer.cancel() says "Terminates this timer, discarding any
>> currently scheduled tasks."
>
> Yes, that's the intention.
>
>> so it might disregard the "done" check been done in ScheduleTask resulting
>> in false positive...
>
> If we reach timer.cancel() before the timer fires off the task we don't need
> the task
> canceling it means the test can exit immediately - not wait 20 or 30 seconds.
>
> If it does fire because cancel is too slow, it will see "done==true"
>
> So perhaps I'm not following your point ?
>
>
>> Should we do Thread.yield() instead?
>
> No.
>
>> I'll tidy it up a bit more.
OK. So, it means ScheduleTask should ideally never be executed if drawString
with infinite transform takes lesser time < 30s, which is desirable and test
can exit.
-------------
PR: https://git.openjdk.org/jdk/pull/11179