Repository: hbase Updated Branches: refs/heads/branch-2 28d0d8c5c -> 6cebe0622
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/6cebe062 Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/6cebe062 Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/6cebe062 Branch: refs/heads/branch-2 Commit: 6cebe0622503af4ed892e78ccc2acf2c7b3b0f95 Parents: 28d0d8c Author: zhangduo <[email protected]> Authored: Thu Jun 21 15:28:52 2018 +0800 Committer: zhangduo <[email protected]> Committed: Fri Jun 22 10:20:06 2018 +0800 ---------------------------------------------------------------------- .../hadoop/hbase/HBaseTestingUtility.java | 22 ++++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hbase/blob/6cebe062/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;
