JavaFX app with Spring doesn't terminate on Mac OS X with Cmd-Q

Fabrizio Giudici Fabrizio.Giudici at tidalwave.it
Fri Jul 5 04:21:35 PDT 2013


On Fri, 05 Jul 2013 12:46:35 +0200, Anthony Petrov  
<anthony.petrov at oracle.com> wrote:

> Hi Fabrizio,
>
> Cmd-Q (or, rather the implicit exit machinery) does not call  
> System.exit(). All it does when it detects that there's no FX windows  
> open, it terminates the FX Event Thread. This is clearly stated in the  
> javadoc [1].

Ok, I missed the link between Cmd-Q and the rest.

> The rest depends on the JVM. As long as there are active non-daemon  
> threads running, the JVM won't exit. I suspect that the services you're  
> running create non-daemon threads and they prevent the JVM from exiting.  
> So the solution you came up with (calling applicationContext.close())  
> looks correct: you tell the background services to shut down, and then  
> the application can terminate as expected.
>
> Hope this helps.

It makes perfectly sense. Thanks.

-- 
Fabrizio Giudici - Java Architect @ Tidalwave s.a.s.
"We make Java work. Everywhere."
http://tidalwave.it/fabrizio/blog - fabrizio.giudici at tidalwave.it


More information about the openjfx-dev mailing list