diff --git src/main/java/org/apache/hadoop/hbase/zookeeper/MiniZooKeeperCluster.java src/main/java/org/apache/hadoop/hbase/zookeeper/MiniZooKeeperCluster.java index 9b78235..1940072 100644 --- src/main/java/org/apache/hadoop/hbase/zookeeper/MiniZooKeeperCluster.java +++ src/main/java/org/apache/hadoop/hbase/zookeeper/MiniZooKeeperCluster.java @@ -198,7 +198,9 @@ public class MiniZooKeeperCluster { private void recreateDir(File dir) throws IOException { if (dir.exists()) { - FileUtil.fullyDelete(dir); + if(!FileUtil.fullyDelete(dir)) { + throw new IOException("Could not delete zk base directory: " + dir); + } } try { dir.mkdirs(); @@ -214,6 +216,7 @@ public class MiniZooKeeperCluster { if (!started) { return; } + // shut down all the zk servers for (int i = 0; i < standaloneServerFactoryList.size(); i++) { NIOServerCnxnFactory standaloneServerFactory = @@ -225,6 +228,10 @@ public class MiniZooKeeperCluster { throw new IOException("Waiting for shutdown of standalone server"); } } + for (ZooKeeperServer zkServer: zooKeeperServers) { + //explicitly close ZKDatabase since ZookeeperServer does not close them + zkServer.getZKDatabase().close(); + } // clear everything started = false;