Github user vanzin commented on a diff in the pull request:
https://github.com/apache/spark/pull/20706#discussion_r171667286
--- Diff: core/src/main/scala/org/apache/spark/util/Utils.scala ---
@@ -267,44 +264,20 @@ private[spark] object Utils extends Logging {
}
}
- /**
- * JDK equivalent of `chmod 700 file`.
- *
- * @param file the file whose permissions will be modified
- * @return true if the permissions were successfully changed, false
otherwise.
- */
- def chmod700(file: File): Boolean = {
- file.setReadable(false, false) &&
- file.setReadable(true, true) &&
- file.setWritable(false, false) &&
- file.setWritable(true, true) &&
- file.setExecutable(false, false) &&
- file.setExecutable(true, true)
- }
-
/**
* Create a directory inside the given parent directory. The directory
is guaranteed to be
* newly created, and is not marked for automatic deletion.
*/
def createDirectory(root: String, namePrefix: String = "spark"): File = {
- var attempts = 0
- val maxAttempts = MAX_DIR_CREATION_ATTEMPTS
- var dir: File = null
- while (dir == null) {
- attempts += 1
- if (attempts > maxAttempts) {
- throw new IOException("Failed to create a temp directory (under "
+ root + ") after " +
- maxAttempts + " attempts!")
- }
- try {
- dir = new File(root, namePrefix + "-" + UUID.randomUUID.toString)
- if (dir.exists() || !dir.mkdirs()) {
- dir = null
- }
- } catch { case e: SecurityException => dir = null; }
+ val prefix = namePrefix + "-"
--- End diff --
This code was written when Spark still supported Java 1.6, and
`java.nio.file` did not exist.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]