hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cutt...@apache.org
Subject svn commit: r417569 - in /lucene/hadoop/trunk: ./ src/java/org/apache/hadoop/conf/ src/java/org/apache/hadoop/dfs/ src/java/org/apache/hadoop/io/ src/java/org/apache/hadoop/mapred/ src/java/org/apache/hadoop/util/
Date Tue, 27 Jun 2006 19:42:16 GMT
Author: cutting
Date: Tue Jun 27 12:42:15 2006
New Revision: 417569

URL: http://svn.apache.org/viewvc?rev=417569&view=rev
Log:
HADOOP-325.  Correctly initialize RPC parameter classes, and remove workaround code.  Contributed
by Owen.

Modified:
    lucene/hadoop/trunk/CHANGES.txt
    lucene/hadoop/trunk/src/java/org/apache/hadoop/conf/Configuration.java
    lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/DFSClient.java
    lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/DFSShell.java
    lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/DataNode.java
    lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/NameNode.java
    lucene/hadoop/trunk/src/java/org/apache/hadoop/io/ObjectWritable.java
    lucene/hadoop/trunk/src/java/org/apache/hadoop/io/WritableName.java
    lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/JobClient.java
    lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/JobInProgress.java
    lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/JobTracker.java
    lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/TaskTracker.java
    lucene/hadoop/trunk/src/java/org/apache/hadoop/util/RunJar.java

Modified: lucene/hadoop/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/CHANGES.txt?rev=417569&r1=417568&r2=417569&view=diff
==============================================================================
--- lucene/hadoop/trunk/CHANGES.txt (original)
+++ lucene/hadoop/trunk/CHANGES.txt Tue Jun 27 12:42:15 2006
@@ -74,6 +74,10 @@
     duplicated DataNodeInfo.  The former is now deprecated, replaced
     by the latter.  (Konstantin Shvachko via cutting)
 
+18. HADOOP-325.  Fix a problem initializing RPC parameter classes, and
+    remove the workaround used to initialize classes.
+    (omalley via cutting)
+
 
 Release 0.3.2 - 2006-06-09
 

Modified: lucene/hadoop/trunk/src/java/org/apache/hadoop/conf/Configuration.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/java/org/apache/hadoop/conf/Configuration.java?rev=417569&r1=417568&r2=417569&view=diff
==============================================================================
--- lucene/hadoop/trunk/src/java/org/apache/hadoop/conf/Configuration.java (original)
+++ lucene/hadoop/trunk/src/java/org/apache/hadoop/conf/Configuration.java Tue Jun 27 12:42:15
2006
@@ -242,7 +242,7 @@
     if (valueString == null)
       return defaultValue;
     try {
-      return classLoader.loadClass(valueString);
+      return Class.forName(valueString, true, classLoader);
     } catch (ClassNotFoundException e) {
       throw new RuntimeException(e);
     }

Modified: lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/DFSClient.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/DFSClient.java?rev=417569&r1=417568&r2=417569&view=diff
==============================================================================
--- lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/DFSClient.java (original)
+++ lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/DFSClient.java Tue Jun 27 12:42:15
2006
@@ -53,9 +53,6 @@
     private long defaultBlockSize;
     private short defaultReplication;
     
-    // required for unknown reason to make WritableFactories work distributed
-    static { new DFSFileInfo(); }
-
     /**
      * A map from name -> DFSOutputStream of files that are currently being
      * written by this client.

Modified: lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/DFSShell.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/DFSShell.java?rev=417569&r1=417568&r2=417569&view=diff
==============================================================================
--- lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/DFSShell.java (original)
+++ lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/DFSShell.java Tue Jun 27 12:42:15 2006
@@ -28,9 +28,6 @@
  **************************************************/
 public class DFSShell extends ToolBase {
 
-    // required for unknown reason to make WritableFactories work distributed
-    static { new DatanodeInfo(); }
-
     FileSystem fs;
 
     /**

Modified: lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/DataNode.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/DataNode.java?rev=417569&r1=417568&r2=417569&view=diff
==============================================================================
--- lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/DataNode.java (original)
+++ lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/DataNode.java Tue Jun 27 12:42:15 2006
@@ -67,9 +67,6 @@
     //private static long numGigs = Configuration.get().getLong("dfs.datanode.maxgigs", 100);
     //
 
-    // required for unknown reason to make WritableFactories work distributed
-    static { new BlockCommand(); }
-
     /**
      * Util method to build socket addr from string
      */

Modified: lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/NameNode.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/NameNode.java?rev=417569&r1=417568&r2=417569&view=diff
==============================================================================
--- lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/NameNode.java (original)
+++ lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/NameNode.java Tue Jun 27 12:42:15 2006
@@ -68,12 +68,6 @@
     
     /** only used for testing purposes  */
     private boolean stopRequested = false;
-    // force loading of classes that will be received via RPC
-    // creating an instance will do the static initialization of the class
-    static {
-      new DatanodeRegistration();
-      new Block();
-    }
 
     /** Format a new filesystem.  Destroys any filesystem that may already
      * exist at this location.  **/

Modified: lucene/hadoop/trunk/src/java/org/apache/hadoop/io/ObjectWritable.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/java/org/apache/hadoop/io/ObjectWritable.java?rev=417569&r1=417568&r2=417569&view=diff
==============================================================================
--- lucene/hadoop/trunk/src/java/org/apache/hadoop/io/ObjectWritable.java (original)
+++ lucene/hadoop/trunk/src/java/org/apache/hadoop/io/ObjectWritable.java Tue Jun 27 12:42:15
2006
@@ -172,9 +172,10 @@
     if (declaredClass == null) {
       try {
         declaredClass =
-          Thread.currentThread().getContextClassLoader().loadClass(className);
+          Class.forName(className, true, 
+                        Thread.currentThread().getContextClassLoader());
       } catch (ClassNotFoundException e) {
-        throw new RuntimeException(e.toString());
+        throw new RuntimeException("readObject can't find class", e);
       }
     }    
 
@@ -217,10 +218,11 @@
     } else {                                      // Writable
       Class instanceClass = null;
       try {
-        instanceClass = Thread.currentThread().getContextClassLoader()
-          .loadClass(UTF8.readString(in));
+        instanceClass = 
+          Class.forName(UTF8.readString(in), true, 
+                        Thread.currentThread().getContextClassLoader());
       } catch (ClassNotFoundException e) {
-        throw new RuntimeException(e.toString());
+        throw new RuntimeException("readObject can't find class", e);
       }
       
       Writable writable = WritableFactories.newInstance(instanceClass);

Modified: lucene/hadoop/trunk/src/java/org/apache/hadoop/io/WritableName.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/java/org/apache/hadoop/io/WritableName.java?rev=417569&r1=417568&r2=417569&view=diff
==============================================================================
--- lucene/hadoop/trunk/src/java/org/apache/hadoop/io/WritableName.java (original)
+++ lucene/hadoop/trunk/src/java/org/apache/hadoop/io/WritableName.java Tue Jun 27 12:42:15
2006
@@ -62,9 +62,12 @@
     if (writableClass != null)
       return writableClass;
     try {
-      return Thread.currentThread().getContextClassLoader().loadClass(name);
+      return Class.forName(name, true, 
+                           Thread.currentThread().getContextClassLoader());
     } catch (ClassNotFoundException e) {
-      throw new IOException(e.toString());
+      IOException newE = new IOException("WritableName can't load class");
+      newE.initCause(e);
+      throw newE;
     }
   }
 

Modified: lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/JobClient.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/JobClient.java?rev=417569&r1=417568&r2=417569&view=diff
==============================================================================
--- lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/JobClient.java (original)
+++ lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/JobClient.java Tue Jun 27 12:42:15
2006
@@ -39,9 +39,6 @@
 
     static long MAX_JOBPROFILE_AGE = 1000 * 2;
 
-    // required for unknown reason to make WritableFactories work distributed
-    static { new JobStatus(); new JobProfile(); new ClusterStatus(); }
-
     /**
      * A NetworkedJob is an implementation of RunningJob.  It holds
      * a JobProfile object to provide some info, and interacts with the

Modified: lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/JobInProgress.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/JobInProgress.java?rev=417569&r1=417568&r2=417569&view=diff
==============================================================================
--- lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/JobInProgress.java (original)
+++ lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/JobInProgress.java Tue Jun 27 12:42:15
2006
@@ -116,7 +116,7 @@
           try {
             ClassLoader loader =
               new URLClassLoader(new URL[]{ localFs.pathToFile(localJarFile).toURL() });
-            Class inputFormatClass = loader.loadClass(ifClassName);
+            Class inputFormatClass = Class.forName(ifClassName, true, loader);
             inputFormat = (InputFormat)inputFormatClass.newInstance();
           } catch (Exception e) {
             throw new IOException(e.toString());

Modified: lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/JobTracker.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/JobTracker.java?rev=417569&r1=417568&r2=417569&view=diff
==============================================================================
--- lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/JobTracker.java (original)
+++ lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/JobTracker.java Tue Jun 27 12:42:15
2006
@@ -50,9 +50,6 @@
       idFormat.setGroupingUsed(false);
     }
 
-    // required for unknown reason to make WritableFactories work distributed
-    static { new TaskTrackerStatus(); }
-
     private int nextJobId = 1;
 
     public static final Log LOG = LogFactory.getLog("org.apache.hadoop.mapred.JobTracker");

Modified: lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/TaskTracker.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/TaskTracker.java?rev=417569&r1=417568&r2=417569&view=diff
==============================================================================
--- lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/TaskTracker.java (original)
+++ lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/TaskTracker.java Tue Jun 27 12:42:15
2006
@@ -41,9 +41,6 @@
 
     static final int STALE_STATE = 1;
 
-    // required for unknown reason to make WritableFactories work distributed
-    static { new MapTask(); new ReduceTask(); new MapOutputLocation(); }
-
     public static final Log LOG =
     LogFactory.getLog("org.apache.hadoop.mapred.TaskTracker");
 

Modified: lucene/hadoop/trunk/src/java/org/apache/hadoop/util/RunJar.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/java/org/apache/hadoop/util/RunJar.java?rev=417569&r1=417568&r2=417569&view=diff
==============================================================================
--- lucene/hadoop/trunk/src/java/org/apache/hadoop/util/RunJar.java (original)
+++ lucene/hadoop/trunk/src/java/org/apache/hadoop/util/RunJar.java Tue Jun 27 12:42:15 2006
@@ -120,7 +120,7 @@
       new URLClassLoader((URL[])classPath.toArray(new URL[0]));
 
     Thread.currentThread().setContextClassLoader(loader);
-    Class mainClass = loader.loadClass(mainClassName);
+    Class mainClass = Class.forName(mainClassName, true, loader);
     Method main = mainClass.getMethod("main", new Class[] {
       Array.newInstance(String.class, 0).getClass()
     });



Mime
View raw message