HBASE-13733 Failed MiniZooKeeperCluster startup did not shutdown ZK servers (Stephen Jiang)
This commit is contained in:
parent
774bb5677e
commit
c695d1c249
@ -289,10 +289,6 @@ public class MiniZooKeeperCluster {
|
|||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
public void shutdown() throws IOException {
|
public void shutdown() throws IOException {
|
||||||
if (!started) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// shut down all the zk servers
|
// shut down all the zk servers
|
||||||
for (int i = 0; i < standaloneServerFactoryList.size(); i++) {
|
for (int i = 0; i < standaloneServerFactoryList.size(); i++) {
|
||||||
NIOServerCnxnFactory standaloneServerFactory =
|
NIOServerCnxnFactory standaloneServerFactory =
|
||||||
@ -304,19 +300,21 @@ public class MiniZooKeeperCluster {
|
|||||||
throw new IOException("Waiting for shutdown of standalone server");
|
throw new IOException("Waiting for shutdown of standalone server");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
standaloneServerFactoryList.clear();
|
||||||
|
|
||||||
for (ZooKeeperServer zkServer: zooKeeperServers) {
|
for (ZooKeeperServer zkServer: zooKeeperServers) {
|
||||||
//explicitly close ZKDatabase since ZookeeperServer does not close them
|
//explicitly close ZKDatabase since ZookeeperServer does not close them
|
||||||
zkServer.getZKDatabase().close();
|
zkServer.getZKDatabase().close();
|
||||||
}
|
}
|
||||||
|
|
||||||
// clear everything
|
|
||||||
started = false;
|
|
||||||
activeZKServerIndex = 0;
|
|
||||||
standaloneServerFactoryList.clear();
|
|
||||||
clientPortList.clear();
|
|
||||||
zooKeeperServers.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
|
/**@return clientPort return clientPort if there is another ZK backup can run
|
||||||
|
Loading…
x
Reference in New Issue
Block a user