<Swing Dev> [11][JDK-8176512][TEST_BUG] add a minimal delay to java/awt/Paint/bug8024864.java
Sergey Bylokhov
Sergey.Bylokhov at oracle.com
Fri Jan 19 23:50:23 UTC 2018
On 18/01/2018 19:39, Krishna Addepalli wrote:
> Yes you are right, that waitForIdle() will make sure that all the events will be processed on EDT. However, lets say the last event on the queue takes sometime to process, then, syncNativeQueue could return true, since there are no more events generated on the queue, and the waitForIdle could return.
> For example, the event on the EDT could be waiting for a network operation to complete, and till such time it might not generate any more events. But, there is a high chance that, while it is waiting, that thread could get swapped by another thread. If that thread tries to access the so called response from the network immediately, it won't be able to get it, since the other thread has not finished getting it.
> Similarly, when there is a paint event, there is a small possibility that the EDT thread might get swapped out before it could draw its contents to the screen, and if the main thread accesses the screen immediately, it could get wrong results. This is what would have happened in OEL, for this test case.
This situation should also be covered by the Toolkit.sync() which is
called inside waitForIdle(); Since this test additionally waits 100 ms
in waitTillShown() its is strange why waitForIdle() does not work.
--
Best regards, Sergey.
More information about the swing-dev
mailing list