瀏覽代碼

Fix for HADOOP-66. Delete dfs temp files on JVM exit.

git-svn-id: https://svn.apache.org/repos/asf/lucene/hadoop/trunk@386220 13f79535-47bb-0310-9956-ffa450edef68
Doug Cutting 19 年之前
父節點
當前提交
00cea5a675
共有 1 個文件被更改,包括 5 次插入3 次删除
  1. 5 3
      src/java/org/apache/hadoop/dfs/DFSClient.java

+ 5 - 3
src/java/org/apache/hadoop/dfs/DFSClient.java

@@ -557,9 +557,11 @@ class DFSClient implements FSConstants {
         }
 
         private File newBackupFile() throws IOException {
-          return conf.getFile("dfs.data.dir",
-                              "tmp"+File.separator+
-                              "client-"+Math.abs(r.nextLong()));
+          File result = conf.getFile("dfs.data.dir",
+                                     "tmp"+File.separator+
+                                     "client-"+Math.abs(r.nextLong()));
+          result.deleteOnExit();
+          return result;
         }
 
         /**