org.apache.hadoop.hive.common.FileUtils.createTempFile()方法的使用及代码示例

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

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

FileUtils.createTempFile介绍

[英]create temporary file and register it to delete-on-exit hook. File.deleteOnExit is not used for possible memory leakage. Make sure to use #deleteTmpFile(File) after the file is no longer required, and has been deleted to avoid a memory leak.
[中]创建临时文件并将其注册以在退出挂钩时删除。文件deleteOnExit不用于可能的内存泄漏。确保在不再需要该文件并且该文件已被删除后使用#deletettmpfile(文件),以避免内存泄漏。

代码示例

代码示例来源:origin: apache/hive

/**
 * @param conf
 * @return per-session temp file
 * @throws IOException
 */
private static File createTempFile(HiveConf conf) throws IOException {
 String lScratchDir = HiveConf.getVar(conf, HiveConf.ConfVars.LOCALSCRATCHDIR);
 String sessionID = conf.getVar(HiveConf.ConfVars.HIVESESSIONID);
 return FileUtils.createTempFile(lScratchDir, sessionID, ".pipeout");
}

代码示例来源:origin: apache/drill

/**
 * @param conf
 * @return per-session temp file
 * @throws IOException
 */
private static File createTempFile(HiveConf conf) throws IOException {
 String lScratchDir = HiveConf.getVar(conf, HiveConf.ConfVars.LOCALSCRATCHDIR);
 String sessionID = conf.getVar(HiveConf.ConfVars.HIVESESSIONID);
 return FileUtils.createTempFile(lScratchDir, sessionID, ".pipeout");
}

代码示例来源:origin: apache/hive

@Test
 public void deleteOnExit() throws IOException {
  File file = FileUtils.createTempFile(null, "tmp", null);
  Assert.assertTrue(ShutdownHookManager.isRegisteredToDeleteOnExit(file));
  FileUtils.deleteTmpFile(file);
  Assert.assertFalse(ShutdownHookManager.isRegisteredToDeleteOnExit(file));
 }
}

相关文章