@After public void tearDown() throws Exception { try { List<String> children = zk.getChildren(baseLockPath, false); for (String child : children) { ZkUtils.safeDelete(zk, baseLockPath + "/" + child, -1); } ZkUtils.safeDelete(zk, baseLockPath, -1); } catch (KeeperException ke) { // suppress because who cares what went wrong after our tests did their thing? } finally { zk.close(); } }
@Before public void setup() throws Exception { zk = newZooKeeper(hostString, timeout); // be sure that the lock-place is created ZkUtils.recursiveSafeDelete(zk, baseLockPath, -1); zk.create(baseLockPath, new byte[] {}, ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT); zkSessionManager = new BaseZkSessionManager(zk); }