本文整理汇总了Java中org.apache.curator.utils.ZKPaths.deleteChildren方法的典型用法代码示例。如果您正苦于以下问题:Java ZKPaths.deleteChildren方法的具体用法?Java ZKPaths.deleteChildren怎么用?Java ZKPaths.deleteChildren使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.curator.utils.ZKPaths
的用法示例。
在下文中一共展示了ZKPaths.deleteChildren方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import org.apache.curator.utils.ZKPaths; //导入方法依赖的package包/类
/**
* 测试入口
*/
public static void main(String[] args) throws Exception {
client.start();
ZooKeeper zookeeper = client.getZookeeperClient().getZooKeeper();
System.out.println(ZKPaths.fixForNamespace(path, "sub"));
System.out.println(ZKPaths.makePath(path, "sub"));
System.out.println(ZKPaths.getNodeFromPath(path + "/sub1"));
PathAndNode pn = ZKPaths.getPathAndNode(path + "/sub1");
System.out.println(pn.getPath());
System.out.println(pn.getNode());
String path1 = path + "/child1";
String path2 = path + "/child2";
ZKPaths.mkdirs(zookeeper, path1);
ZKPaths.mkdirs(zookeeper, path2);
System.out.println(ZKPaths.getSortedChildren(zookeeper, path));
ZKPaths.deleteChildren(zookeeper, path, true);
}
示例2: shutdown
import org.apache.curator.utils.ZKPaths; //导入方法依赖的package包/类
@Override
public void shutdown(JobStatus jobStatus) throws Exception {
if (jobStatus.isGloballyTerminalState()) {
LOG.info("Shutting down");
for (CompletedCheckpoint checkpoint : completedCheckpoints) {
try {
removeShutdown(checkpoint, jobStatus);
} catch (Exception e) {
LOG.error("Failed to discard checkpoint.", e);
}
}
completedCheckpoints.clear();
String path = "/" + client.getNamespace();
LOG.info("Removing {} from ZooKeeper", path);
ZKPaths.deleteChildren(client.getZookeeperClient().getZooKeeper(), path, true);
} else {
LOG.info("Suspending");
// Clear the local handles, but don't remove any state
completedCheckpoints.clear();
// Release the state handle locks in ZooKeeper such that they can be deleted
checkpointsInZooKeeper.releaseAll();
}
}