com.sun.enterprise.util.io.FileUtils.deleteFileNowOrLater()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(1.2k)|赞(0)|评价(0)|浏览(134)

本文整理了Java中com.sun.enterprise.util.io.FileUtils.deleteFileNowOrLater()方法的一些代码示例,展示了FileUtils.deleteFileNowOrLater()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FileUtils.deleteFileNowOrLater()方法的具体详情如下:
包路径:com.sun.enterprise.util.io.FileUtils
类名称:FileUtils
方法名:deleteFileNowOrLater

FileUtils.deleteFileNowOrLater介绍

[英]Delete a file. If impossible to delete then try to delete it when the JVM exits. E.g. when Windows is using a jar in the current JVM -- you can not delete the jar until the JVM dies.
[中]删除一个文件。如果无法删除,则在JVM退出时尝试删除它。例如,当Windows在当前JVM中使用jar时——在JVM死掉之前,您不能删除jar。

代码示例

代码示例来源:origin: org.glassfish.main.core/kernel

/**
   * It is **Essential** to delete this file!  Other code will assume the server
   * is running if it exists.
   * Any old App is currently (10/10/10) allowed to add a shutdownhook with a System.exit()
   * which is GUARANTEED to prevent the shutdown hook for deleting the pidfile to run.
   * So -- we always do it BEFORE trying to exit.
   */
  private void deletePidFile(ServerEnvironment env) {
    File pidFile = new File(env.getConfigDirPath(), "pid");

    if (pidFile.isFile()) {
      FileUtils.deleteFileNowOrLater(pidFile);
    }
  }
}

代码示例来源:origin: org.glassfish.main.cluster/cluster-cli

_rendezvousOccurred = true;
} catch (CommandException ce) {
  FileUtils.deleteFileNowOrLater(instanceDir);
  throw ce;

相关文章