LuciferYang commented on code in PR #36529:
URL: https://github.com/apache/spark/pull/36529#discussion_r1153925550


##########
common/network-common/src/main/java/org/apache/spark/network/util/JavaUtils.java:
##########
@@ -362,6 +364,60 @@ public static byte[] bufferToArray(ByteBuffer buffer) {
     }
   }
 
+  /**
+   * Create a temporary directory inside `java.io.tmpdir` with default 
namePrefix "spark".
+   * The directory will be automatically deleted when the VM shuts down.
+   */
+  public static File createTempDir() throws IOException {
+    return createTempDir(System.getProperty("java.io.tmpdir"), "spark");
+  }
+
+  /**
+   * Create a temporary directory inside the given parent directory. The 
directory will be
+   * automatically deleted when the VM shuts down.
+   */
+  public static File createTempDir(String root, String namePrefix) throws 
IOException {

Review Comment:
   > 1. Revert [SPARK-39204](https://issues.apache.org/jira/browse/SPARK-39204) 
to break  the call from `o.a.spark.util.Utils#createTempDir` to 
`JavaUtils#createTempDir`, then all other calls of `JavaUtils#createTempDir()` 
only exist in test case. We can move `createTempDir ` from JavaUtils to test 
helper class, but we need to accept these duplicate codes.
   
   @srowen As I mentioned, revert  
[SPARK-39204](https://issues.apache.org/jira/browse/SPARK-39204) to break  the 
call from `Utils#createTempDir` to `JavaUtils#createTempDir`  can achieve the 
purpose you mentioned.  I will give a pr soon to let's know what happens after 
the revet
   
   
   
   
   
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to