Repository: hbase Updated Branches: refs/heads/branch-1.1 86e2c3b72 -> 7a67e6c9d
HBASE-13733 Failed MiniZooKeeperCluster startup did not shutdown ZK servers (Stephen Jiang) Project: http://git-wip-us.apache.org/repos/asf/hbase/repo Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/7a67e6c9 Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/7a67e6c9 Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/7a67e6c9 Branch: refs/heads/branch-1.1 Commit: 7a67e6c9d2ed2bce869736c17207af4f41ad6ec5 Parents: 86e2c3b Author: tedyu <[email protected]> Authored: Thu May 21 14:04:09 2015 -0700 Committer: tedyu <[email protected]> Committed: Thu May 21 14:04:09 2015 -0700 ---------------------------------------------------------------------- .../hbase/zookeeper/MiniZooKeeperCluster.java | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hbase/blob/7a67e6c9/hbase-server/src/main/java/org/apache/hadoop/hbase/zookeeper/MiniZooKeeperCluster.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/zookeeper/MiniZooKeeperCluster.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/zookeeper/MiniZooKeeperCluster.java index fe8a17e..8b6f9de 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/zookeeper/MiniZooKeeperCluster.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/zookeeper/MiniZooKeeperCluster.java @@ -289,10 +289,6 @@ public class MiniZooKeeperCluster { * @throws IOException */ public void shutdown() throws IOException { - if (!started) { - return; - } - // shut down all the zk servers for (int i = 0; i < standaloneServerFactoryList.size(); i++) { NIOServerCnxnFactory standaloneServerFactory = @@ -304,19 +300,21 @@ public class MiniZooKeeperCluster { throw new IOException("Waiting for shutdown of standalone server"); } } + standaloneServerFactoryList.clear(); + for (ZooKeeperServer zkServer: zooKeeperServers) { //explicitly close ZKDatabase since ZookeeperServer does not close them zkServer.getZKDatabase().close(); } - - // clear everything - started = false; - activeZKServerIndex = 0; - standaloneServerFactoryList.clear(); - clientPortList.clear(); zooKeeperServers.clear(); - LOG.info("Shutdown MiniZK cluster with all ZK servers"); + // clear everything + if (started) { + started = false; + activeZKServerIndex = 0; + clientPortList.clear(); + LOG.info("Shutdown MiniZK cluster with all ZK servers"); + } } /**@return clientPort return clientPort if there is another ZK backup can run
