瀏覽代碼

HADOOP-5607. Fix NPE in TestCapacityScheduler.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/core/branches/branch-0.20@761083 13f79535-47bb-0310-9956-ffa450edef68
Christopher Douglas 16 年之前
父節點
當前提交
3306fe122b
共有 2 個文件被更改,包括 6 次插入3 次删除
  1. 2 0
      CHANGES.txt
  2. 4 3
      src/mapred/org/apache/hadoop/mapred/JobInProgress.java

+ 2 - 0
CHANGES.txt

@@ -832,6 +832,8 @@ Release 0.20.0 - Unreleased
     the running job's information printed to the user's stdout as it runs.
     (omalley)
 
+    HADOOP-5607. Fix NPE in TestCapacityScheduler. (cdouglas)
+
 Release 0.19.2 - Unreleased
 
   BUG FIXES

+ 4 - 3
src/mapred/org/apache/hadoop/mapred/JobInProgress.java

@@ -95,7 +95,7 @@ class JobInProgress {
   private volatile boolean jobFailed = false;
 
   JobPriority priority = JobPriority.NORMAL;
-  JobTracker jobtracker = null;
+  final JobTracker jobtracker;
 
   // NetworkTopology Node to the set of TIPs
   Map<Node, List<TaskInProgress>> nonRunningMapCache;
@@ -213,6 +213,7 @@ class JobInProgress {
     this.numReduceTasks = conf.getNumReduceTasks();
     this.maxLevel = NetworkTopology.DEFAULT_HOST_LEVEL;
     this.anyCacheLevel = this.maxLevel+1;
+    this.jobtracker = null;
   }
   
   /**
@@ -2117,7 +2118,6 @@ class JobInProgress {
   }
   
   private synchronized void terminateJob(int jobTerminationState) {
-    final JobTrackerInstrumentation metrics = jobtracker.getInstrumentation();
     if ((status.getRunState() == JobStatus.RUNNING) ||
         (status.getRunState() == JobStatus.PREP)) {
       if (jobTerminationState == JobStatus.FAILED) {
@@ -2138,7 +2138,8 @@ class JobInProgress {
                                      this.finishedReduceTasks);
       }
       garbageCollect();
-      metrics.terminateJob(this.conf, this.status.getJobID());
+      jobtracker.getInstrumentation().terminateJob(
+          this.conf, this.status.getJobID());
     }
   }