JDK-8100982 : Provide ability to alter the implicit "exit on last window closed" behavior
  • Type: Enhancement
  • Component: javafx
  • Sub-Component: application-lifecycle
  • Affected Version: fx2.0
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • Submitted: 2011-07-12
  • Updated: 2021-08-27
  • Resolved: 2012-10-10
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 7
7u6Fixed
Related Reports
Blocks :  
Relates :  
Relates :  
Relates :  
Relates :  
Description
We should consider adding a property that an Application could set in its start method to indicate that it doesn't want the implicit "exit on last window closed" behavior. Such an app would stay alive until it explicitly called Platform.exit().

Proposed method is:

public final void Application.setImplicitExit(boolean implicitExit)

Comments
Additional sqe tests are not needed, we will rely on unit tests coverage
10-10-2012

verified in b14
27-06-2012

Added the following new unit tests in rt-closed/tests/app-life-cycle/LifeCycleTests (run as part of "ant full-test") . Unit Tests: com/sun/javafx/application/ListenerExitTest com/sun/javafx/application/ListenerIdle1Test com/sun/javafx/application/ListenerIdle2Test com/sun/javafx/application/SingleExitExplicit1Test com/sun/javafx/application/SingleExitExplicit2Test com/sun/javafx/application/SingleExitImplicitTest com/sun/javafx/application/SingleNoShowExplicit1Test com/sun/javafx/application/SingleNoShowExplicit2Test com/sun/javafx/application/SingleNoShowImplicitTest com/sun/javafx/application/SwingExitExplicit1Test com/sun/javafx/application/SwingExitExplicit2Test com/sun/javafx/application/SwingExitImplicitTest
24-05-2012

While writing tests for this I realized that what I proposed earlier won't work for Swing or SWT apps that embed a JavaFX Scene, but have no Application class. As a result I'm going back to my original idea of putting the implicitExit attribute on Platform (which is where exit() is so it makes just as much sense, if not more, to be there anyway). To address this feature, I propose to add the following pair of methods to the Platform class. public static void setImplicitExit(boolean implicitExit) public static boolean isImplicitExit() If this attribute is true, the JavaFX runtime will implicitly shutdown when the last window is closed. If this attribute is false, the application will continue to run normally even after the last window is closed, until the application calls Platform.exit(). The default value is true, which preserves the existing behavior.
01-05-2012

To address this feature, I propose to add the following methods to the Application class. public final void setImplicitExit(boolean implicitExit) public final boolean isImplicitExit() If this attribute is true, the JavaFX runtime will implicitly shutdown when the last window is closed. If this attribute is false, the application will continue to run normally even after the last window is closed, until the application calls Platform.exit(). The default value is true.
18-04-2012

SQE / OK 1 day of test development
27-03-2012

Bump the priority to match that of the dependent issues.
17-03-2012