hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From omal...@apache.org
Subject svn commit: r582394 - in /lucene/hadoop/trunk: CHANGES.txt src/java/org/apache/hadoop/mapred/JobConf.java
Date Fri, 05 Oct 2007 21:17:01 GMT
Author: omalley
Date: Fri Oct  5 14:17:01 2007
New Revision: 582394

URL: http://svn.apache.org/viewvc?rev=582394&view=rev
Log:
HADOOP-1906.  Warn users about an obsolete mapred-default.xml file. 
Contributed by acmurthy.

Modified:
    lucene/hadoop/trunk/CHANGES.txt
    lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/JobConf.java

Modified: lucene/hadoop/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/CHANGES.txt?rev=582394&r1=582393&r2=582394&view=diff
==============================================================================
--- lucene/hadoop/trunk/CHANGES.txt (original)
+++ lucene/hadoop/trunk/CHANGES.txt Fri Oct  5 14:17:01 2007
@@ -355,7 +355,10 @@
     class, and improve documentation.  (Cameron Pope via cutting)
 
     HADOOP-1926. Add a random text writer example/benchmark so that we can
-    benchmark compression codecs on random data.
+    benchmark compression codecs on random data. (acmurthy via omalley)
+
+    HADOOP-1906. Warn the user if they have an obsolete madred-default.xml
+    file in their configuration directory. (acmurthy via omalley)
 
 Release 0.14.2 - unreleased
 

Modified: lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/JobConf.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/JobConf.java?rev=582394&r1=582393&r2=582394&view=diff
==============================================================================
--- lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/JobConf.java (original)
+++ lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/JobConf.java Fri Oct  5 14:17:01
2007
@@ -29,6 +29,8 @@
 import java.net.URL;
 import java.net.URLDecoder;
 
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.conf.Configuration;
@@ -48,16 +50,21 @@
  * of input files, and where the output files should be written. */
 public class JobConf extends Configuration {
   
+  private static final Log LOG = LogFactory.getLog(JobConf.class);
+
   /**
    * Construct a map/reduce job configuration.
    */
-  public JobConf() {}
+  public JobConf() {
+	  checkWarnAndLoadMapredDefault();
+  }
 
   /** 
    * Construct a map/reduce job configuration.
    * @param exampleClass a class whose containing jar is used as the job's jar.
    */
   public JobConf(Class exampleClass) {
+    checkWarnAndLoadMapredDefault();
     setJarByClass(exampleClass);
   }
   
@@ -68,6 +75,7 @@
    */
   public JobConf(Configuration conf) {
     super(conf);
+    checkWarnAndLoadMapredDefault();
   }
 
 
@@ -96,9 +104,24 @@
    */
   public JobConf(Path config) {
     super();
+    checkWarnAndLoadMapredDefault();
     addResource(config);
   }
 
+  /**
+   * Checks if <b>mapred-default.xml</b> is on the CLASSPATH, if so
+   * it warns the user and loads it as a {@link Configuration} resource.
+   * @deprecated Remove in hadoop-0.16.0 via HADOOP-1843
+   */
+  private void checkWarnAndLoadMapredDefault() {
+    URL mapredDefaultConf = getClassLoader().getResource("mapred-default.xml");
+    if (mapredDefaultConf != null) {
+      LOG.warn("Deprecated resource 'mapred-default.xml' is being loaded, " +
+          "please discontinue its usage!");
+      addResource("mapred-default.xml");
+    }
+  }
+  
   public String getJar() { return get("mapred.jar"); }
   public void setJar(String jar) { set("mapred.jar", jar); }
   



Mime
View raw message