hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From te...@apache.org
Subject hbase git commit: HBASE-14115 Fix resource leak in HMasterCommandLine (Yuhao Bi)
Date Wed, 22 Jul 2015 12:59:25 GMT
Repository: hbase
Updated Branches:
  refs/heads/branch-1 48b968e32 -> 45d52129d


HBASE-14115 Fix resource leak in HMasterCommandLine (Yuhao Bi)


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/45d52129
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/45d52129
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/45d52129

Branch: refs/heads/branch-1
Commit: 45d52129dd53207efb0a6408cf6869e0d5b23df3
Parents: 48b968e
Author: tedyu <yuzhihong@gmail.com>
Authored: Wed Jul 22 05:59:13 2015 -0700
Committer: tedyu <yuzhihong@gmail.com>
Committed: Wed Jul 22 05:59:13 2015 -0700

----------------------------------------------------------------------
 .../apache/hadoop/hbase/master/HMasterCommandLine.java | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/45d52129/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMasterCommandLine.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMasterCommandLine.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMasterCommandLine.java
index 6ac681e..d6b436c 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMasterCommandLine.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMasterCommandLine.java
@@ -255,6 +255,7 @@ public class HMasterCommandLine extends ServerCommandLine {
       // Don't try more than once
       conf.setInt(HConstants.HBASE_CLIENT_RETRIES_NUMBER, 1);
       adm = new HBaseAdmin(getConf());
+      adm.shutdown();
     } catch (MasterNotRunningException e) {
       LOG.error("Master not running");
       return 1;
@@ -264,12 +265,18 @@ public class HMasterCommandLine extends ServerCommandLine {
     } catch (IOException e) {
       LOG.error("Got IOException: " +e.getMessage(), e);
       return 1;
-    }
-    try {
-      adm.shutdown();
     } catch (Throwable t) {
       LOG.error("Failed to stop master", t);
       return 1;
+    } finally {
+      if (adm != null) {
+        try {
+          adm.close();
+        } catch (Throwable t) {
+          LOG.error("Failed to close Admin", t);
+          return 1;
+        }
+      }
     }
     return 0;
   }


Mime
View raw message