You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by dd...@apache.org on 2009/08/21 08:59:46 UTC

svn commit: r806430 - in /hadoop/common/trunk: CHANGES.txt src/java/org/apache/hadoop/conf/Configuration.java src/test/core/org/apache/hadoop/conf/TestConfiguration.java

Author: ddas
Date: Fri Aug 21 06:59:45 2009
New Revision: 806430

URL: http://svn.apache.org/viewvc?rev=806430&view=rev
Log:
HADOOP-6103. Clones the classloader as part of Configuration clone. Contributed by Amareshwari Sriramadasu.

Modified:
    hadoop/common/trunk/CHANGES.txt
    hadoop/common/trunk/src/java/org/apache/hadoop/conf/Configuration.java
    hadoop/common/trunk/src/test/core/org/apache/hadoop/conf/TestConfiguration.java

Modified: hadoop/common/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/CHANGES.txt?rev=806430&r1=806429&r2=806430&view=diff
==============================================================================
--- hadoop/common/trunk/CHANGES.txt (original)
+++ hadoop/common/trunk/CHANGES.txt Fri Aug 21 06:59:45 2009
@@ -928,6 +928,9 @@
     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

Modified: hadoop/common/trunk/src/java/org/apache/hadoop/conf/Configuration.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/src/java/org/apache/hadoop/conf/Configuration.java?rev=806430&r1=806429&r2=806430&view=diff
==============================================================================
--- hadoop/common/trunk/src/java/org/apache/hadoop/conf/Configuration.java (original)
+++ hadoop/common/trunk/src/java/org/apache/hadoop/conf/Configuration.java Fri Aug 21 06:59:45 2009
@@ -243,6 +243,9 @@
     synchronized(Configuration.class) {
       REGISTRY.put(this, null);
     }
+    this.classLoader = other.classLoader;
+    this.loadDefaults = other.loadDefaults;
+    setQuietMode(other.getQuietMode());
   }
   
   /**
@@ -1373,6 +1376,10 @@
     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);

Modified: hadoop/common/trunk/src/test/core/org/apache/hadoop/conf/TestConfiguration.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/src/test/core/org/apache/hadoop/conf/TestConfiguration.java?rev=806430&r1=806429&r2=806430&view=diff
==============================================================================
--- hadoop/common/trunk/src/test/core/org/apache/hadoop/conf/TestConfiguration.java (original)
+++ hadoop/common/trunk/src/test/core/org/apache/hadoop/conf/TestConfiguration.java Fri Aug 21 06:59:45 2009
@@ -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 @@
     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()