RFR: 8369306: Implement invokeAndWait and finishTerminating on headless platform

Kevin Rushforth kcr at openjdk.org
Fri Oct 10 11:55:24 UTC 2025


On Fri, 10 Oct 2025 09:25:39 GMT, Jose Pereda <jpereda at openjdk.org> wrote:

> This PR implements `invokeAndWait` and `finishTerminating` for the headless platform and includes two system tests, one for each, that fail before this PR, and pass after it.

I left a recommendation to also set `"prism.order"` to `"sw"` as discussed in [this mailing list thread](https://mail.openjdk.org/pipermail/openjfx-dev/2025-October/056676.html) and a couple other minor comments.

tests/system/src/test/java/test/com/sun/glass/ui/headless/HeadlessApplication1Test.java line 45:

> 43:     @BeforeAll
> 44:     public static void setup() throws Exception {
> 45:         System.setProperty("glass.platform", "Headless");

I recommend also setting `"prism.order=sw"`.

tests/system/src/test/java/test/com/sun/glass/ui/headless/HeadlessApplication1Test.java line 57:

> 55:             assertTrue(Platform.isFxApplicationThread());
> 56:             new Thread(() -> {
> 57:                 assertFalse(Platform.isFxApplicationThread());

Btw, an Exception or Error in this thread won't propagate to the test runner, so if this assertion ever fails it would print the exception, but not cause the test to fail. The test will timeout anyway if this happens, so it should be fine.

tests/system/src/test/java/test/com/sun/glass/ui/headless/HeadlessApplication2Test.java line 39:

> 37:     @BeforeAll
> 38:     public static void setup() throws Exception {
> 39:         System.setProperty("glass.platform", "Headless");

I recommend also setting `"prism.order=sw"`.

tests/system/src/test/java/test/com/sun/glass/ui/headless/HeadlessApplication2Test.java line 49:

> 47:             Platform.runLater(Platform::exit);
> 48:         });
> 49:         Util.sleep(10);

Is 10msec enough?

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

PR Review: https://git.openjdk.org/jfx/pull/1934#pullrequestreview-3322867205
PR Review Comment: https://git.openjdk.org/jfx/pull/1934#discussion_r2419651998
PR Review Comment: https://git.openjdk.org/jfx/pull/1934#discussion_r2419668916
PR Review Comment: https://git.openjdk.org/jfx/pull/1934#discussion_r2419675588
PR Review Comment: https://git.openjdk.org/jfx/pull/1934#discussion_r2419685540


More information about the openjfx-dev mailing list