當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。