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

addShutdownHook fails if called after shutdown has commenced.

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P3
    • 7
    • 6u17, 7
    • core-libs
    • b55
    • 7
    • b58
    • generic, sparc
    • generic, solaris_10

    Description

      If you call addShutdownHook after shutdown has already started, you should get IllegalStateException, as specified. If the call to addShutdownHook is the first one in this JDK, you will get an ExceptionInInitializerError instead, as below:

      Exception in thread "main" java.lang.ExceptionInInitializerError
      at java.lang.Runtime.addShutdownHook(Runtime.java:209)
      at java.util.logging.LogManager.<init>(LogManager.java:246)
      at java.util.logging.LogManager$1.run(LogManager.java:194)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.util.logging.LogManager.<clinit>(LogManager.java:175)
      at LoggingDeadlock2$JavaChild.main(LoggingDeadlock2.java:106)
      Caused by: java.lang.IllegalStateException: Shutdown in progress
      at java.lang.Shutdown.add(Shutdown.java:77)
      at java.lang.ApplicationShutdownHooks.<clinit>(ApplicationShutdownHooks.java:39)

      Attachments

        Issue Links

          Activity

            People

              mchung Mandy Chung
              mchung Mandy Chung
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: