HADOOP-6269. Fix threading issue with defaultResource in Configuration.

Contributed by Sreekanth Ramakrishnan


git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@882831 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Christopher Douglas 2009-11-21 04:22:02 +00:00
parent bd92322d22
commit 09ec9c4ffc
2 changed files with 7 additions and 3 deletions

View File

@ -1181,6 +1181,9 @@ Release 0.20.2 - Unreleased
count at the start of each block in Hadoop archives. (Ben Slusky, Tom count at the start of each block in Hadoop archives. (Ben Slusky, Tom
White, and Mahadev Konar via cdouglas) White, and Mahadev Konar via cdouglas)
HADOOP-6269. Fix threading issue with defaultResource in Configuration.
(Sreekanth Ramakrishnan via cdouglas)
Release 0.20.1 - 2009-09-01 Release 0.20.1 - 2009-09-01
INCOMPATIBLE CHANGES INCOMPATIBLE CHANGES

View File

@ -44,6 +44,7 @@
import java.util.Set; import java.util.Set;
import java.util.StringTokenizer; import java.util.StringTokenizer;
import java.util.WeakHashMap; import java.util.WeakHashMap;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
@ -168,8 +169,8 @@ public class Configuration implements Iterable<Map.Entry<String,String>>,
* List of default Resources. Resources are loaded in the order of the list * List of default Resources. Resources are loaded in the order of the list
* entries * entries
*/ */
private static final ArrayList<String> defaultResources = private static final CopyOnWriteArrayList<String> defaultResources =
new ArrayList<String>(); new CopyOnWriteArrayList<String>();
private static final Map<ClassLoader, Map<String, Class<?>>> private static final Map<ClassLoader, Map<String, Class<?>>>
CACHE_CLASSES = new WeakHashMap<ClassLoader, Map<String, Class<?>>>(); CACHE_CLASSES = new WeakHashMap<ClassLoader, Map<String, Class<?>>>();
@ -1685,7 +1686,7 @@ public String toString() {
return sb.toString(); return sb.toString();
} }
private void toString(ArrayList resources, StringBuffer sb) { private void toString(List resources, StringBuffer sb) {
ListIterator i = resources.listIterator(); ListIterator i = resources.listIterator();
while (i.hasNext()) { while (i.hasNext()) {
if (i.nextIndex() != 0) { if (i.nextIndex() != 0) {