RFR: 8369306: Implement invokeAndWait and finishTerminating on headless platform [v3]
Andy Goryachev
angorya at openjdk.org
Mon Oct 13 16:15:43 UTC 2025
On Sat, 11 Oct 2025 08:52:12 GMT, Johan Vos <jvos at openjdk.org> wrote:
>> I'm testing on an M1, but you are right, on different environments it could take longer.
>>
>> I've added now an exit latch from `PlatformImplShim.test_getPlatformExitLatch()`, so we wait whatever is needed until `PlatformImpl.tkExit()` finishes, and then those 10 ms should be more than enough (but we still need to wait a couple of ms nonetheless until the JavaFX thread is fully gone).
>
> In general, I'm not a fan of adding hard-numbered sleep times. Either the expected events are delivered, or they are not (yet). The hard sleep pattern leads to either slowdowns or to failing tests on slow environments.
> Using CountdownLatches and deterministic flows is much better for testing, imho.
> Since the Util.sleep is widely used in other system tests, I'm ok with using it here as well -- but I still think it is a dangerous approach.
I agree with @johanvos , it's always better to wait for the lock (with a timeout)
-------------
PR Review Comment: https://git.openjdk.org/jfx/pull/1934#discussion_r2426775608
More information about the openjfx-dev
mailing list