src/java.base/share/classes/java/io/DeleteOnExitHook.java

Print this page

        

*** 24,33 **** --- 24,34 ---- */ package java.io; import java.util.*; import java.io.File; + import jdk.internal.misc.SharedSecrets; /** * This class holds a set of filenames to be deleted on VM exit through a shutdown hook. * A set is used both to prevent double-insertion of the same file as well as offer * quick removal.
*** 39,49 **** // DeleteOnExitHook must be the last shutdown hook to be invoked. // Application shutdown hooks may add the first file to the // delete on exit list and cause the DeleteOnExitHook to be // registered during shutdown in progress. So set the // registerShutdownInProgress parameter to true. ! sun.misc.SharedSecrets.getJavaLangAccess() .registerShutdownHook(2 /* Shutdown hook invocation order */, true /* register even if shutdown in progress */, new Runnable() { public void run() { runHooks(); --- 40,50 ---- // DeleteOnExitHook must be the last shutdown hook to be invoked. // Application shutdown hooks may add the first file to the // delete on exit list and cause the DeleteOnExitHook to be // registered during shutdown in progress. So set the // registerShutdownInProgress parameter to true. ! SharedSecrets.getJavaLangAccess() .registerShutdownHook(2 /* Shutdown hook invocation order */, true /* register even if shutdown in progress */, new Runnable() { public void run() { runHooks();