本文整理匯總了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();
}
}