Repository: hbase
Updated Branches:
  refs/heads/HBASE-19064 25add19a0 -> 15fcb4574 (forced update)


HBASE-20767 Always close hbaseAdmin along with connection in HBTU


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

Branch: refs/heads/HBASE-19064
Commit: 0d784efc372752146bb9f1f9a6fb21aba2fbeeaa
Parents: 72784c2
Author: zhangduo <zhang...@apache.org>
Authored: Thu Jun 21 15:28:52 2018 +0800
Committer: zhangduo <zhang...@apache.org>
Committed: Thu Jun 21 21:01:19 2018 +0800

----------------------------------------------------------------------
 .../hadoop/hbase/HBaseTestingUtility.java       | 22 ++++++++++----------
 1 file changed, 11 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/0d784efc/hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java
----------------------------------------------------------------------
diff --git 
a/hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java 
b/hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java
index 2bdb0a0..7cc9333 100644
--- 
a/hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java
+++ 
b/hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java
@@ -1051,12 +1051,15 @@ public class HBaseTestingUtility extends 
HBaseZKTestingUtility {
    * Starts the hbase cluster up again after shutting it down previously in a
    * test.  Use this if you want to keep dfs/zk up and just stop/start hbase.
    * @param servers number of region servers
-   * @throws IOException
    */
   public void restartHBaseCluster(int servers) throws IOException, 
InterruptedException {
-    if(connection != null){
-      connection.close();
-      connection = null;
+    if (hbaseAdmin != null) {
+      hbaseAdmin.close();
+      hbaseAdmin = null;
+    }
+    if (this.connection != null) {
+      this.connection.close();
+      this.connection = null;
     }
     this.hbaseCluster = new MiniHBaseCluster(this.conf, servers);
     // Don't leave here till we've done a successful scan of the hbase:meta
@@ -1092,10 +1095,6 @@ public class HBaseTestingUtility extends 
HBaseZKTestingUtility {
    */
   public void shutdownMiniCluster() throws Exception {
     LOG.info("Shutting down minicluster");
-    if (this.connection != null && !this.connection.isClosed()) {
-      this.connection.close();
-      this.connection = null;
-    }
     shutdownMiniHBaseCluster();
     shutdownMiniDFSCluster();
     shutdownMiniZKCluster();
@@ -1107,14 +1106,16 @@ public class HBaseTestingUtility extends 
HBaseZKTestingUtility {
 
   /**
    * Shutdown HBase mini cluster.  Does not shutdown zk or dfs if running.
-   * @throws IOException
    */
   public void shutdownMiniHBaseCluster() throws IOException {
     if (hbaseAdmin != null) {
       hbaseAdmin.close();
       hbaseAdmin = null;
     }
-
+    if (this.connection != null) {
+      this.connection.close();
+      this.connection = null;
+    }
     // unset the configuration for MIN and MAX RS to start
     conf.setInt(ServerManager.WAIT_ON_REGIONSERVERS_MINTOSTART, -1);
     conf.setInt(ServerManager.WAIT_ON_REGIONSERVERS_MAXTOSTART, -1);
@@ -1124,7 +1125,6 @@ public class HBaseTestingUtility extends 
HBaseZKTestingUtility {
       this.hbaseCluster.waitUntilShutDown();
       this.hbaseCluster = null;
     }
-
     if (zooKeeperWatcher != null) {
       zooKeeperWatcher.close();
       zooKeeperWatcher = null;

Reply via email to