From reviews-return-620732-archive-asf-public=cust-asf.ponee.io@spark.apache.org Thu Mar 1 20:26:08 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 7DA6818064D for ; Thu, 1 Mar 2018 20:26:07 +0100 (CET) Received: (qmail 39404 invoked by uid 500); 1 Mar 2018 19:26:06 -0000 Mailing-List: contact reviews-help@spark.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list reviews@spark.apache.org Received: (qmail 39382 invoked by uid 99); 1 Mar 2018 19:26:05 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 01 Mar 2018 19:26:05 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id D1188E96EB; Thu, 1 Mar 2018 19:26:05 +0000 (UTC) From: rxin To: reviews@spark.apache.org Reply-To: reviews@spark.apache.org References: In-Reply-To: Subject: [GitHub] spark pull request #20706: [SPARK-23550][core] Cleanup `Utils`. Content-Type: text/plain Message-Id: <20180301192605.D1188E96EB@git1-us-west.apache.org> Date: Thu, 1 Mar 2018 19:26:05 +0000 (UTC) Github user rxin commented on a diff in the pull request: https://github.com/apache/spark/pull/20706#discussion_r171666996 --- 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 -- was there a reason you rewriting this? --- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org For additional commands, e-mail: reviews-help@spark.apache.org