hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From oz...@apache.org
Subject hadoop git commit: HDFS-7008. xlator should be closed upon exit from DFSAdmin#genericRefresh(). (ozawa)
Date Tue, 24 Feb 2015 15:00:16 GMT
Repository: hadoop
Updated Branches:
  refs/heads/branch-2 b9e82e27f -> 280dda5bc


HDFS-7008. xlator should be closed upon exit from DFSAdmin#genericRefresh(). (ozawa)

(cherry picked from commit b53fd7163bc3a4eef4632afb55e5513c7c592fcf)


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

Branch: refs/heads/branch-2
Commit: 280dda5bcdc7aadfbced2e93dd8060e8547805b9
Parents: b9e82e2
Author: Tsuyoshi Ozawa <ozawa@apache.org>
Authored: Tue Feb 24 23:59:34 2015 +0900
Committer: Tsuyoshi Ozawa <ozawa@apache.org>
Committed: Tue Feb 24 23:59:59 2015 +0900

----------------------------------------------------------------------
 hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt     |  3 ++
 .../org/apache/hadoop/hdfs/tools/DFSAdmin.java  | 49 +++++++++++---------
 2 files changed, 30 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/280dda5b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
index 8b16301..7427f81 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
+++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
@@ -714,6 +714,9 @@ Release 2.7.0 - UNRELEASED
     HDFS-7805. NameNode recovery prompt should be printed on console (Surendra
     Singh Lilhore via Colin P. McCabe)
 
+    HDFS-7008. xlator should be closed upon exit from DFSAdmin#genericRefresh().
+    (ozawa)
+
     BREAKDOWN OF HDFS-7584 SUBTASKS AND RELATED JIRAS
 
       HDFS-7720. Quota by Storage Type API, tools and ClientNameNode

http://git-wip-us.apache.org/repos/asf/hadoop/blob/280dda5b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/DFSAdmin.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/DFSAdmin.java
b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/DFSAdmin.java
index 7d0edb2..abbd46b 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/DFSAdmin.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/DFSAdmin.java
@@ -1496,30 +1496,35 @@ public class DFSAdmin extends FsShell {
       RPC.getProxy(xface, RPC.getProtocolVersion(xface), address,
         ugi, conf, NetUtils.getDefaultSocketFactory(conf), 0);
 
-    GenericRefreshProtocol xlator =
-      new GenericRefreshProtocolClientSideTranslatorPB(proxy);
-
-    // Refresh
-    Collection<RefreshResponse> responses = xlator.refresh(identifier, args);
-
-    int returnCode = 0;
-
-    // Print refresh responses
-    System.out.println("Refresh Responses:\n");
-    for (RefreshResponse response : responses) {
-      System.out.println(response.toString());
-
-      if (returnCode == 0 && response.getReturnCode() != 0) {
-        // This is the first non-zero return code, so we should return this
-        returnCode = response.getReturnCode();
-      } else if (returnCode != 0 && response.getReturnCode() != 0) {
-        // Then now we have multiple non-zero return codes,
-        // so we merge them into -1
-        returnCode = -1;
+    Collection<RefreshResponse> responses = null;
+    try (GenericRefreshProtocolClientSideTranslatorPB xlator =
+        new GenericRefreshProtocolClientSideTranslatorPB(proxy);) {
+      // Refresh
+      responses = xlator.refresh(identifier, args);
+
+      int returnCode = 0;
+
+      // Print refresh responses
+      System.out.println("Refresh Responses:\n");
+      for (RefreshResponse response : responses) {
+        System.out.println(response.toString());
+
+        if (returnCode == 0 && response.getReturnCode() != 0) {
+          // This is the first non-zero return code, so we should return this
+          returnCode = response.getReturnCode();
+        } else if (returnCode != 0 && response.getReturnCode() != 0) {
+          // Then now we have multiple non-zero return codes,
+          // so we merge them into -1
+          returnCode = - 1;
+        }
+      }
+      return returnCode;
+    } finally {
+      if (responses == null) {
+        System.out.println("Failed to get response.\n");
+        return -1;
       }
     }
-
-    return returnCode;
   }
 
   /**


Mime
View raw message