Proper shutdown of JavaFX if Platform.startup and Platform.setImplicitExit(false) is used (on OS-X)

Tom Schindl tom.schindl at
Fri Jun 10 18:12:58 UTC 2016


In Java9 PlatformImpl.startup was provide as API in Platform which is
great but not enough to solve my current problem.

Let me start with the following I can not use Application.launch() to
bootstrap my OSGi-Application because this would block endless because
if the native launching going on with Eclipse-Native-Launcher.

So in Java8 I can make use of the internal code PlatformImpl.startup()
method to bootstrap my application.

This works perfectly fine. My problem is the shutdown which I need to to
know is happening because i need to take action then (persiting the
application state).

In Java8 because I was already stepping into internals I registered a
PlatformImpl.FinishListener and get informed about the shutdown.
Unfortunately in Java9 this API has not been published and because of
jigsaw I'm not able to access it (which I eventually welcome :-)

So here I am now with my Java8-Code I'm unable to get working on Java9.

I see the following options:
a) make FinishListener API (I would vote against that)
b) modify the newly introduced method Platform.startup() to take 2

   Platform.startup( Runnable start, Runnable shutdown )

Does that make sense? Is there a chance to get that into JDK9? In fact
those 2 runnables are the replacement for

Application.start == 1st runnable
Application.stop  == 2nd runnable


Thomas Schindl, CTO EDV Systemhaus GmbH
Eduard-Bodem-Gasse 5-7, A-6020 Innsbruck
Reg. Nr. FN 222302s am Firmenbuchgericht Innsbruck

More information about the openjfx-dev mailing list