Browse Source

HADOOP-6269. Fix threading issue with defaultResource in Configuration. Contributed by Sreekanth Ramakrishnan.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-0.20-security-203@1098854 13f79535-47bb-0310-9956-ffa450edef68
Arun Murthy 14 years ago
parent
commit
bd874e5f9e
2 changed files with 7 additions and 3 deletions
  1. 3 0
      CHANGES.txt
  2. 4 3
      src/core/org/apache/hadoop/conf/Configuration.java

+ 3 - 0
CHANGES.txt

@@ -1714,6 +1714,9 @@ Release 0.20.2 - Unreleased
     HADOOP-6315. Avoid incorrect use of BuiltInflater/BuiltInDeflater in
     GzipCodec. (Aaron Kimball via cdouglas)
 
+    HADOOP-6269. Fix threading issue with defaultResource in Configuration.
+    (Sreekanth Ramakrishnan via cdouglas)
+
 Release 0.20.1 - 2009-09-01
 
   INCOMPATIBLE CHANGES

+ 4 - 3
src/core/org/apache/hadoop/conf/Configuration.java

@@ -43,6 +43,7 @@ import java.util.Properties;
 import java.util.Set;
 import java.util.StringTokenizer;
 import java.util.WeakHashMap;
+import java.util.concurrent.CopyOnWriteArrayList;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
@@ -165,8 +166,8 @@ public class Configuration implements Iterable<Map.Entry<String,String>>,
    * List of default Resources. Resources are loaded in the order of the list 
    * entries
    */
-  private static final ArrayList<String> defaultResources = 
-    new ArrayList<String>();
+  private static final CopyOnWriteArrayList<String> defaultResources =
+    new CopyOnWriteArrayList<String>();
   
   /**
    * Flag to indicate if the storage of resource which updates a key needs 
@@ -1356,7 +1357,7 @@ public class Configuration implements Iterable<Map.Entry<String,String>>,
     return sb.toString();
   }
 
-  private void toString(ArrayList resources, StringBuffer sb) {
+  private void toString(List resources, StringBuffer sb) {
     ListIterator i = resources.listIterator();
     while (i.hasNext()) {
       if (i.nextIndex() != 0) {