浏览代码

HADOOP-9729. The example code of org.apache.hadoop.util.Tool is incorrect. Contributed by hellojinjie
(cherry picked from commit ec2748dedbc500bd554aa62ca76ccab593129966)

Jason Lowe 10 年之前
父节点
当前提交
1523ed5a76

+ 3 - 0
hadoop-common-project/hadoop-common/CHANGES.txt

@@ -185,6 +185,9 @@ Release 2.8.0 - UNRELEASED
     HADOOP-7165. listLocatedStatus(path, filter) is not redefined in FilterFs
     (Hairong Kuang via jlowe)
 
+    HADOOP-9729. The example code of org.apache.hadoop.util.Tool is incorrect
+    (hellojinjie via jlowe)
+
 Release 2.7.1 - UNRELEASED
 
   INCOMPATIBLE CHANGES

+ 6 - 2
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/Tool.java

@@ -54,8 +54,12 @@ import org.apache.hadoop.conf.Configurable;
  *         job.setReducerClass(MyReducer.class);
  *
  *         // Submit the job, then poll for progress until the job is complete
- *         JobClient.runJob(job);
- *         return 0;
+ *         RunningJob runningJob = JobClient.runJob(job);
+ *         if (runningJob.isSuccessful()) {
+ *           return 0;
+ *         } else {
+ *           return 1;
+ *         }
  *       }
  *       
  *       public static void main(String[] args) throws Exception {