hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cutt...@apache.org
Subject svn commit: r399461 - in /lucene/hadoop/trunk: ./ bin/ src/java/org/apache/hadoop/conf/ src/java/org/apache/hadoop/io/ src/java/org/apache/hadoop/mapred/ src/java/org/apache/hadoop/util/
Date Wed, 03 May 2006 22:25:17 GMT
Author: cutting
Date: Wed May  3 15:25:14 2006
New Revision: 399461

URL: http://svn.apache.org/viewcvs?rev=399461&view=rev
Log:
Reverting change 399426, which broke distributed operation.

Removed:
    lucene/hadoop/trunk/src/java/org/apache/hadoop/util/RunJar.java
Modified:
    lucene/hadoop/trunk/CHANGES.txt
    lucene/hadoop/trunk/bin/hadoop
    lucene/hadoop/trunk/src/java/org/apache/hadoop/conf/Configuration.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/TaskRunner.java

Modified: lucene/hadoop/trunk/CHANGES.txt
URL: http://svn.apache.org/viewcvs/lucene/hadoop/trunk/CHANGES.txt?rev=399461&r1=399460&r2=399461&view=diff
==============================================================================
--- lucene/hadoop/trunk/CHANGES.txt (original)
+++ lucene/hadoop/trunk/CHANGES.txt Wed May  3 15:25:14 2006
@@ -161,16 +161,11 @@
 42. HADOOP-184. Re-structure some test code to better support testing
     on a cluster.  (Mahadev Konar via cutting)
 
-43. HADOOP-189.  Fix MapReduce in standalone configuration to
-    correctly handle job jar files that contain a lib directory with
-    nested jar files.  (cutting)
-
-44. HADOOP-191  Add streaming package, Hadoop's first contrib module.
+43. HADOOP-191  Add streaming package, Hadoop's first contrib module.
     This permits folks to easily submit MapReduce jobs whose map and
     reduce functions are implemented by shell commands.  Use
     'bin/hadoop jar build/hadoop-streaming.jar' to get details.
     (Michel Tourn via cutting)
-
 
 Release 0.1.1 - 2006-04-08
 

Modified: lucene/hadoop/trunk/bin/hadoop
URL: http://svn.apache.org/viewcvs/lucene/hadoop/trunk/bin/hadoop?rev=399461&r1=399460&r2=399461&view=diff
==============================================================================
--- lucene/hadoop/trunk/bin/hadoop (original)
+++ lucene/hadoop/trunk/bin/hadoop Wed May  3 15:25:14 2006
@@ -135,7 +135,14 @@
 elif [ "$COMMAND" = "job" ] ; then
   CLASS=org.apache.hadoop.mapred.JobClient
 elif [ "$COMMAND" = "jar" ] ; then
-  CLASS=org.apache.hadoop.util.RunJar
+  JAR="$1"
+  shift
+  CLASS=`"$0" org.apache.hadoop.util.PrintJarMainClass "$JAR"`
+  if [ $? != 0 ]; then
+    echo "Error: Could not find main class in jar file $JAR"
+    exit 1
+  fi
+  CLASSPATH=${CLASSPATH}:${JAR}
 else
   CLASS=$COMMAND
 fi

Modified: lucene/hadoop/trunk/src/java/org/apache/hadoop/conf/Configuration.java
URL: http://svn.apache.org/viewcvs/lucene/hadoop/trunk/src/java/org/apache/hadoop/conf/Configuration.java?rev=399461&r1=399460&r2=399461&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 Wed May  3 15:25:14
2006
@@ -241,7 +241,7 @@
     if (valueString == null)
       return defaultValue;
     try {
-      return classLoader.loadClass(valueString);
+      return Class.forName(valueString);
     } catch (ClassNotFoundException e) {
       throw new RuntimeException(e);
     }

Modified: lucene/hadoop/trunk/src/java/org/apache/hadoop/io/ObjectWritable.java
URL: http://svn.apache.org/viewcvs/lucene/hadoop/trunk/src/java/org/apache/hadoop/io/ObjectWritable.java?rev=399461&r1=399460&r2=399461&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 Wed May  3 15:25:14
2006
@@ -88,8 +88,7 @@
       declaredClass = (Class)PRIMITIVE_NAMES.get(className);
       if (declaredClass == null) {
         try {
-          declaredClass =
-            Thread.currentThread().getContextClassLoader().loadClass(className);
+          declaredClass = Class.forName(className);
         } catch (ClassNotFoundException e) {
           throw new RuntimeException(e.toString());
         }
@@ -171,8 +170,7 @@
     Class declaredClass = (Class)PRIMITIVE_NAMES.get(className);
     if (declaredClass == null) {
       try {
-        declaredClass =
-          Thread.currentThread().getContextClassLoader().loadClass(className);
+        declaredClass = Class.forName(className);
       } catch (ClassNotFoundException e) {
         throw new RuntimeException(e.toString());
       }
@@ -217,8 +215,7 @@
     } else {                                      // Writable
       Class instanceClass = null;
       try {
-        instanceClass = Thread.currentThread().getContextClassLoader()
-          .loadClass(UTF8.readString(in));
+        instanceClass = Class.forName(UTF8.readString(in));
       } catch (ClassNotFoundException e) {
         throw new RuntimeException(e.toString());
       }

Modified: lucene/hadoop/trunk/src/java/org/apache/hadoop/io/WritableName.java
URL: http://svn.apache.org/viewcvs/lucene/hadoop/trunk/src/java/org/apache/hadoop/io/WritableName.java?rev=399461&r1=399460&r2=399461&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 Wed May  3 15:25:14
2006
@@ -62,7 +62,7 @@
     if (writableClass != null)
       return writableClass;
     try {
-      return Thread.currentThread().getContextClassLoader().loadClass(name);
+      return Class.forName(name);
     } catch (ClassNotFoundException e) {
       throw new IOException(e.toString());
     }

Modified: lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/TaskRunner.java
URL: http://svn.apache.org/viewcvs/lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/TaskRunner.java?rev=399461&r1=399460&r2=399461&view=diff
==============================================================================
--- lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/TaskRunner.java (original)
+++ lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/TaskRunner.java Wed May  3 15:25:14
2006
@@ -18,7 +18,6 @@
 import org.apache.hadoop.conf.*;
 import org.apache.hadoop.util.LogFormatter;
 import org.apache.hadoop.fs.*;
-import org.apache.hadoop.util.*;
 
 import java.io.*;
 import java.util.jar.*;
@@ -79,7 +78,7 @@
 
       String jar = conf.getJar();
       if (jar != null) {                      // if jar exists, it into workDir
-        RunJar.unJar(new File(jar), workDir);
+        unJar(new File(jar), workDir);
         File[] libs = new File(workDir, "lib").listFiles();
         if (libs != null) {
           for (int i = 0; i < libs.length; i++) {
@@ -221,6 +220,37 @@
         
     }
     return text;
+  }
+
+  private void unJar(File jarFile, File toDir) throws IOException {
+    JarFile jar = new JarFile(jarFile);
+    try {
+      Enumeration entries = jar.entries();
+      while (entries.hasMoreElements()) {
+        JarEntry entry = (JarEntry)entries.nextElement();
+        if (!entry.isDirectory()) {
+          InputStream in = jar.getInputStream(entry);
+          try {
+            File file = new File(toDir, entry.getName());
+            file.getParentFile().mkdirs();
+            OutputStream out = new FileOutputStream(file);
+            try {
+              byte[] buffer = new byte[8192];
+              int i;
+              while ((i = in.read(buffer)) != -1) {
+                out.write(buffer, 0, i);
+              }
+            } finally {
+              out.close();
+            }
+          } finally {
+            in.close();
+          }
+        }
+      }
+    } finally {
+      jar.close();
+    }
   }
 
   /**



Mime
View raw message