HADOOP-6103. Clones the classloader as part of Configuration clone. Contributed by Amareshwari Sriramadasu.
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@806430 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
1f3337996e
commit
0a8e65c23b
@ -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
|
||||
|
@ -243,6 +243,9 @@ public Configuration(Configuration other) {
|
||||
synchronized(Configuration.class) {
|
||||
REGISTRY.put(this, null);
|
||||
}
|
||||
this.classLoader = other.classLoader;
|
||||
this.loadDefaults = other.loadDefaults;
|
||||
setQuietMode(other.getQuietMode());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1373,6 +1376,10 @@ public synchronized void setQuietMode(boolean quietmode) {
|
||||
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);
|
||||
|
@ -21,10 +21,6 @@
|
||||
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 void testClear() throws IOException {
|
||||
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()
|
||||
|
Loading…
Reference in New Issue
Block a user