You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by te...@apache.org on 2015/05/21 23:03:40 UTC

hbase git commit: HBASE-13733 Failed MiniZooKeeperCluster startup did not shutdown ZK servers (Stephen Jiang)

Repository: hbase
Updated Branches:
  refs/heads/branch-1 774bb5677 -> c695d1c24


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

Branch: refs/heads/branch-1
Commit: c695d1c2498c812fea727525f50939244c0f0cd1
Parents: 774bb56
Author: tedyu <yu...@gmail.com>
Authored: Thu May 21 14:03:36 2015 -0700
Committer: tedyu <yu...@gmail.com>
Committed: Thu May 21 14:03:36 2015 -0700

----------------------------------------------------------------------
 .../hbase/zookeeper/MiniZooKeeperCluster.java   | 20 +++++++++-----------
 1 file changed, 9 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/c695d1c2/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