spark-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From andrewor14 <...@git.apache.org>
Subject [GitHub] spark pull request: [SPARK-4236] Cleanup removed applications' fil...
Date Thu, 06 Nov 2014 22:36:24 GMT
Github user andrewor14 commented on a diff in the pull request:

    https://github.com/apache/spark/pull/3126#discussion_r19981671
  
    --- Diff: network/common/src/main/java/org/apache/spark/network/util/JavaUtils.java ---
    @@ -73,4 +79,58 @@ public static int nonNegativeHash(Object obj) {
         int hash = obj.hashCode();
         return hash != Integer.MIN_VALUE ? Math.abs(hash) : 0;
       }
    +
    +  /**
    +   * Delete a file or directory and its contents recursively.
    +   * Don't follow directories if they are symlinks.
    +   * Throws an exception if deletion is unsuccessful.
    +   */
    +  public static void deleteRecursively(File file) throws IOException {
    +    if (file == null) { return; }
    +
    +    if (file.isDirectory() && !isSymlink(file)) {
    +      IOException savedIOException = null;
    +      for (File child : listFilesSafely(file)) {
    +        try {
    +          deleteRecursively(child);
    +        } catch (IOException e) {
    +          // In case of multiple exceptions, only last one will be thrown
    +          savedIOException = e;
    +        }
    +      }
    +      if (savedIOException != null) {
    +        throw savedIOException;
    +      }
    +    }
    +
    +    if (!file.delete()) {
    --- End diff --
    
    ok, that's fine


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Mime
View raw message