当前位置: 首页>>代码示例>>Java>>正文


Java ZKPaths.deleteChildren方法代码示例

本文整理汇总了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);
}
 
开发者ID:bdceo,项目名称:bd-codes,代码行数:26,代码来源:CuratorZKPathsTest.java

示例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();
	}
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:30,代码来源:ZooKeeperCompletedCheckpointStore.java


注:本文中的org.apache.curator.utils.ZKPaths.deleteChildren方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。