Repository: hadoop
Updated Branches:
  refs/heads/branch-2 9b1abb448 -> 958835a3d


MAPREDUCE-6889. Add Job#close API to shutdown MR client services. Contributed 
by Rohith Sharma K S.

(cherry picked from commit fb3b5d33ffb29ee8e1ffbd2eee7a603a5777ebaf)


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/958835a3
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/958835a3
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/958835a3

Branch: refs/heads/branch-2
Commit: 958835a3dc4864d6239800f33be834f518e7d120
Parents: 9b1abb4
Author: Sunil G <sun...@apache.org>
Authored: Mon Jul 17 13:35:15 2017 +0530
Committer: Sunil G <sun...@apache.org>
Committed: Mon Jul 17 13:36:00 2017 +0530

----------------------------------------------------------------------
 .../src/main/java/org/apache/hadoop/mapreduce/Job.java | 13 ++++++++++++-
 .../hadoop/mapreduce/TestMapperReducerCleanup.java     |  4 ++++
 2 files changed, 16 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/958835a3/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/Job.java
----------------------------------------------------------------------
diff --git 
a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/Job.java
 
b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/Job.java
index 84d90de..ee130d6 100644
--- 
a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/Job.java
+++ 
b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/Job.java
@@ -75,7 +75,7 @@ import org.apache.hadoop.yarn.api.records.ReservationId;
  */
 @InterfaceAudience.Public
 @InterfaceStability.Evolving
-public class Job extends JobContextImpl implements JobContext {  
+public class Job extends JobContextImpl implements JobContext, AutoCloseable {
   private static final Log LOG = LogFactory.getLog(Job.class);
 
   @InterfaceStability.Evolving
@@ -1553,4 +1553,15 @@ public class Job extends JobContextImpl implements 
JobContext {
     this.reservationId = reservationId;
   }
   
+  /**
+   * Close the <code>Job</code>.
+   * @throws IOException if fail to close.
+   */
+  @Override
+  public void close() throws IOException {
+    if (cluster != null) {
+      cluster.close();
+      cluster = null;
+    }
+  }
 }

http://git-wip-us.apache.org/repos/asf/hadoop/blob/958835a3/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapreduce/TestMapperReducerCleanup.java
----------------------------------------------------------------------
diff --git 
a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapreduce/TestMapperReducerCleanup.java
 
b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapreduce/TestMapperReducerCleanup.java
index 36ec966..27e4e4f 100644
--- 
a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapreduce/TestMapperReducerCleanup.java
+++ 
b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapreduce/TestMapperReducerCleanup.java
@@ -329,6 +329,10 @@ public class TestMapperReducerCleanup {
     Assert.assertTrue(reduceCleanup);
     Assert.assertTrue(recordReaderCleanup);
     Assert.assertTrue(recordWriterCleanup);
+
+    Assert.assertNotNull(job.getCluster());
+    job.close();
+    Assert.assertNull(job.getCluster());
   }
 
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscr...@hadoop.apache.org
For additional commands, e-mail: common-commits-h...@hadoop.apache.org

Reply via email to