diff --git a/CHANGES.txt b/CHANGES.txt index b48c233a705..e391ab00a57 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -928,6 +928,9 @@ Trunk (unreleased changes) HADOOP-6192. Fix Shell.getUlimitMemoryCommand to not rely on Map-Reduce specific configs. (acmurthy) + HADOOP-6103. Clones the classloader as part of Configuration clone. + (Amareshwari Sriramadasu via ddas) + Release 0.20.1 - Unreleased INCOMPATIBLE CHANGES diff --git a/src/java/org/apache/hadoop/conf/Configuration.java b/src/java/org/apache/hadoop/conf/Configuration.java index fedf5e62f33..3873e66aa6a 100644 --- a/src/java/org/apache/hadoop/conf/Configuration.java +++ b/src/java/org/apache/hadoop/conf/Configuration.java @@ -243,6 +243,9 @@ public class Configuration implements Iterable>, synchronized(Configuration.class) { REGISTRY.put(this, null); } + this.classLoader = other.classLoader; + this.loadDefaults = other.loadDefaults; + setQuietMode(other.getQuietMode()); } /** @@ -1373,6 +1376,10 @@ public class Configuration implements Iterable>, this.quietmode = quietmode; } + synchronized boolean getQuietMode() { + return this.quietmode; + } + /** For debugging. List non-default properties to the terminal and exit. */ public static void main(String[] args) throws Exception { new Configuration().writeXml(System.out); diff --git a/src/test/core/org/apache/hadoop/conf/TestConfiguration.java b/src/test/core/org/apache/hadoop/conf/TestConfiguration.java index 03683880409..52a67b3eb62 100644 --- a/src/test/core/org/apache/hadoop/conf/TestConfiguration.java +++ b/src/test/core/org/apache/hadoop/conf/TestConfiguration.java @@ -21,10 +21,6 @@ import java.io.BufferedWriter; import java.io.File; import java.io.FileWriter; import java.io.IOException; -import java.io.DataInputStream; -import java.io.ByteArrayOutputStream; -import java.io.ByteArrayInputStream; -import java.io.DataOutputStream; import java.util.ArrayList; import java.util.Random; @@ -401,6 +397,17 @@ public class TestConfiguration extends TestCase { assertFalse(conf.iterator().hasNext()); } + public static class Fake_ClassLoader extends ClassLoader { + } + + public void testClassLoader() { + Configuration conf = new Configuration(false); + conf.setQuietMode(false); + conf.setClassLoader(new Fake_ClassLoader()); + Configuration other = new Configuration(conf); + assertTrue(other.getClassLoader() instanceof Fake_ClassLoader); + } + public static void main(String[] argv) throws Exception { junit.textui.TestRunner.main(new String[]{ TestConfiguration.class.getName()