diff --git a/hadoop-mapreduce-project/CHANGES.txt b/hadoop-mapreduce-project/CHANGES.txt index 54589c49475..6f0c8fcd5b2 100644 --- a/hadoop-mapreduce-project/CHANGES.txt +++ b/hadoop-mapreduce-project/CHANGES.txt @@ -347,6 +347,9 @@ Release 2.1.0-beta - UNRELEASED MAPREDUCE-5220. Fix backward incompatibility for TaskCompletionEvent by adding back setTaskID. (Zhijie Shen via acmurthy) + MAPREDUCE-5296. Fix backward incompatibility for JobControl by adding the + omitted addJob. (Zhijie Shen via acmurthy) + BREAKDOWN OF HADOOP-8562 SUBTASKS MAPREDUCE-4739. Some MapReduce tests fail to find winutils. diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/lib/jobcontrol/JobControl.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/lib/jobcontrol/JobControl.java index a2bc70aaf5d..a76e36f349c 100644 --- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/lib/jobcontrol/JobControl.java +++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/lib/jobcontrol/JobControl.java @@ -29,6 +29,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.hadoop.classification.InterfaceAudience; import org.apache.hadoop.classification.InterfaceStability; +import org.apache.hadoop.mapred.jobcontrol.Job; import org.apache.hadoop.mapreduce.lib.jobcontrol.ControlledJob.State; import org.apache.hadoop.util.StringUtils; @@ -135,8 +136,8 @@ public class JobControl implements Runnable { } /** - * Add a new job. - * @param aJob the new job + * Add a new controlled job. + * @param aJob the new controlled job */ synchronized public String addJob(ControlledJob aJob) { String id = this.getNextJobID(); @@ -145,7 +146,15 @@ public class JobControl implements Runnable { jobsInProgress.add(aJob); return id; } - + + /** + * Add a new job. + * @param aJob the new job + */ + synchronized public String addJob(Job aJob) { + return addJob((ControlledJob) aJob); + } + /** * Add a collection of jobs * diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapred/jobcontrol/TestJobControl.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapred/jobcontrol/TestJobControl.java index fef9a351a97..b7f090fe006 100644 --- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapred/jobcontrol/TestJobControl.java +++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapred/jobcontrol/TestJobControl.java @@ -18,7 +18,9 @@ package org.apache.hadoop.mapred.jobcontrol; -import static org.mockito.Mockito.*; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; import java.util.ArrayList; @@ -29,6 +31,7 @@ import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path; import org.apache.hadoop.mapred.JobConf; import org.apache.hadoop.mapred.JobID; +import org.apache.hadoop.mapreduce.lib.jobcontrol.ControlledJob; import org.junit.Test; /** @@ -99,8 +102,8 @@ public class TestJobControl extends junit.framework.TestCase { Job job_4 = new Job(jobConf_4, dependingJobs); JobControl theControl = new JobControl("Test"); - theControl.addJob(job_1); - theControl.addJob(job_2); + theControl.addJob((ControlledJob) job_1); + theControl.addJob((ControlledJob) job_2); theControl.addJob(job_3); theControl.addJob(job_4);