-
Bug
-
Resolution: Fixed
-
P3
-
9
-
JDK9, OS X
-
b135
-
os_x
Run the attached test (not with jtreg but just as main()) on OS X. In JDK9 OS X is the only system supporting Desktop.Action.APP_QUIT_STRATEGY and Desktop.Action.APP_SUDDEN_TERMINATION.
The test sets the QuitStrategy to CLOSE_ALL_WINDOWS. According to the spec, as I understand it, this settings would be ignored if sudden termination is enabled. If it is enabled, OS may at any moment terminate the application using regular system means (kill -9 or Cmd+Q on Mac) without invoking anything in the application, which is obviously fast and efficient.
You may see in line 30
Desktop.getDesktop().enableSuddenTermination();
Running the test, you may see, however, that it works to the very end apparently disregarding enableSuddenTermination().
Now comment out the line 28 with
Desktop.getDesktop().setQuitStrategy(java.awt.desktop.QuitStrategy.CLOSE_ALL_WINDOWS);
and rerun the test again: it would terminate immediately after Cmd+Q keystroke.
Thus, we see that enableSuddenTermination() doesn't cancel strategy settings but the opposite is true: strategy settings is always honored.
The test sets the QuitStrategy to CLOSE_ALL_WINDOWS. According to the spec, as I understand it, this settings would be ignored if sudden termination is enabled. If it is enabled, OS may at any moment terminate the application using regular system means (kill -9 or Cmd+Q on Mac) without invoking anything in the application, which is obviously fast and efficient.
You may see in line 30
Desktop.getDesktop().enableSuddenTermination();
Running the test, you may see, however, that it works to the very end apparently disregarding enableSuddenTermination().
Now comment out the line 28 with
Desktop.getDesktop().setQuitStrategy(java.awt.desktop.QuitStrategy.CLOSE_ALL_WINDOWS);
and rerun the test again: it would terminate immediately after Cmd+Q keystroke.
Thus, we see that enableSuddenTermination() doesn't cancel strategy settings but the opposite is true: strategy settings is always honored.