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 13:00:57 GMT
Repository: hbase
Updated Branches:
  refs/heads/branch-1.2 694600ae8 -> f0042a403


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/f0042a40
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/f0042a40
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/f0042a40

Branch: refs/heads/branch-1.2
Commit: f0042a4038486cfb17ba807134ea448617c8b94d
Parents: 694600a
Author: tedyu <yuzhihong@gmail.com>
Authored: Wed Jul 22 06:00:44 2015 -0700
Committer: tedyu <yuzhihong@gmail.com>
Committed: Wed Jul 22 06:00:44 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/f0042a40/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