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

File.deleteOnExit() should be implemented with shutdown hooks

XMLWordPrintable

    • b63
    • generic, x86
    • generic, linux

      File.deleteOnExit() uses the JVM entry point JVM_OnExit to register an at-exit
      cleanup hook. It currently does not use the shutdown hooks mechanism introduced
      in 1.3 because the API predates shutdown hooks. Unfortunately it turns out that
      due to implementation details these two mechanisms are not orthogonal; in order
      for the JVM at-exit hooks to be called, shutdown hooks need to be initialized.
      Specifically, Terminator.setup() needs to be called during core libraries
      startup.

      A better solution which would reduce the amount of core libraries initialization
      would be to reimplement File.deleteOnExit() to use shutdown hooks. This would
      delay the first call to Terminator.setup() until actually required by the
      application.

            chegar Chris Hegarty
            kbr Kenneth Russell (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: