This is an automated email from the ASF dual-hosted git repository.

sunilg pushed a commit to branch branch-3.1
in repository https://gitbox.apache.org/repos/asf/hadoop.git


The following commit(s) were added to refs/heads/branch-3.1 by this push:
     new 45cf3de  YARN-9833. Race condition when 
DirectoryCollection.checkDirs() runs during container launch. Contributed by 
Peter Bacsko.
45cf3de is described below

commit 45cf3de2e9bf836bbf643aec5076962c1d1de761
Author: Sunil G <sun...@apache.org>
AuthorDate: Tue Sep 17 19:41:38 2019 +0530

    YARN-9833. Race condition when DirectoryCollection.checkDirs() runs during 
container launch. Contributed by Peter Bacsko.
    
    (cherry picked from commit c474e24c0b73c0f52a7d5af2495355f4a0799344)
---
 .../apache/hadoop/yarn/server/nodemanager/DirectoryCollection.java | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/DirectoryCollection.java
 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/DirectoryCollection.java
index 7a840b1..d7282f3 100644
--- 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/DirectoryCollection.java
+++ 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/DirectoryCollection.java
@@ -50,6 +50,7 @@ import org.apache.hadoop.yarn.conf.YarnConfiguration;
 import org.apache.hadoop.yarn.exceptions.YarnRuntimeException;
 
 import com.google.common.annotations.VisibleForTesting;
+import com.google.common.collect.ImmutableList;
 
 /**
  * Manages a list of local storage directories.
@@ -230,7 +231,7 @@ public class DirectoryCollection {
   List<String> getGoodDirs() {
     this.readLock.lock();
     try {
-      return Collections.unmodifiableList(localDirs);
+      return ImmutableList.copyOf(localDirs);
     } finally {
       this.readLock.unlock();
     }
@@ -242,7 +243,7 @@ public class DirectoryCollection {
   List<String> getFailedDirs() {
     this.readLock.lock();
     try {
-      return Collections.unmodifiableList(
+      return ImmutableList.copyOf(
           DirectoryCollection.concat(errorDirs, fullDirs));
     } finally {
       this.readLock.unlock();
@@ -255,7 +256,7 @@ public class DirectoryCollection {
   List<String> getFullDirs() {
     this.readLock.lock();
     try {
-      return Collections.unmodifiableList(fullDirs);
+      return ImmutableList.copyOf(fullDirs);
     } finally {
       this.readLock.unlock();
     }


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscr...@hadoop.apache.org
For additional commands, e-mail: common-commits-h...@hadoop.apache.org

Reply via email to