Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8162840

Desktop. enableSuddenTermination() has no effect

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 9
    • 9
    • client-libs
    • 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.

            azvegint Alexander Zvegintsev
            yan Yuri Nesterenko
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: