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

EventQueue should prevent usage during shutdown hook

    XMLWordPrintable

    Details

    • Subcomponent:
    • CPU:
      x86
    • OS:
      windows_xp

      Description

      A DESCRIPTION OF THE REQUEST :
      EventQueue.invokeLater() and EventQueue.invokeAndWait() should throw an exception in case it is invoked from a shutdown thread.

      This exception should be documented and become part of the new spec (so yes, we're modifying the API specification) but I don't think that this is breaking backwards compatibility because the current behavior is that instead of throwing an exception a deadlock will occur.

      JUSTIFICATION :
      If an application registers a shutdown hook, it is able to know not to rely on the EventQueue (i.e. don't invoke JFrame.dispose()) but 3rd party libraries have absolutely no way of finding out whether they're running inside a shutdown hook or not.

      The only way to prevent deadlocks from occuring is to throw an exception which signals that we're inside a shutdown hook (or the EventQueue is otherwise unavailable).

      This will allow libraries to catch the exception and continue shutting down without interacting with AWT components. For example, temporarily files can be removed, etc... without closing windows.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              art Artem Ananiev
              Reporter:
              gmanwanisunw Girish Manwani (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: