ZooKeeper Java客户端API中如何获取子节点
发表于:2024-10-16 作者:千家信息网编辑
千家信息网最后更新 2024年10月16日,ZooKeeper Java客户端API中如何获取子节点,针对这个问题,这篇文章详细介绍了相对应的分析和解答,希望可以帮助更多想解决这个问题的小伙伴找到更简单易行的方法。获取节点的子节点public
千家信息网最后更新 2024年10月16日ZooKeeper Java客户端API中如何获取子节点
ZooKeeper Java客户端API中如何获取子节点,针对这个问题,这篇文章详细介绍了相对应的分析和解答,希望可以帮助更多想解决这个问题的小伙伴找到更简单易行的方法。
获取节点的子节点
public class ZooKeeper_GetChildren_API_Sync_Usage implements Watcher { private static CountDownLatch connectedSemaphore = new CountDownLatch(1); private static ZooKeeper zk = null; public static void main (String[] args) throws Exception{ String path = "/huangyi"; zk = new ZooKeeper("202.201.13.55:2100", 5000, new ZooKeeper_GetChildren_API_Sync_Usage()); connectedSemaphore.await(); zk.create(path, "".getBytes(), Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT); zk.create(path+"/c1", "".getBytes(), Ids.OPEN_ACL_UNSAFE, CreateMode.EPHEMERAL); ListchildrenList = zk.getChildren(path, true); System.out.println(childrenList); zk.create(path+"/c2", "".getBytes(), Ids.OPEN_ACL_UNSAFE, CreateMode.EPHEMERAL); Thread.sleep( Integer.MAX_VALUE); } public void process(WatchedEvent event) { if (KeeperState.SyncConnected == event.getState()) { if (EventType.None == event.getType() && null == event.getPath()) { connectedSemaphore.countDown(); } else if (event.getType() == EventType.NodeChildrenChanged) { try { System.out.println("ReGet Child:" + zk.getChildren(event.getPath(), true)); } catch (Exception e) {} } } }}
结果打印
[c1]ReGet Child:[c1, c2]
关于ZooKeeper Java客户端API中如何获取子节点问题的解答就分享到这里了,希望以上内容可以对大家有一定的帮助,如果你还有很多疑惑没有解开,可以关注行业资讯频道了解更多相关知识。
节点
问题
客户
客户端
更多
帮助
解答
易行
简单易行
内容
小伙
小伙伴
方法
知识
篇文章
结果
行业
资讯
资讯频道
频道
数据库的安全要保护哪些东西
数据库安全各自的含义是什么
生产安全数据库录入
数据库的安全性及管理
数据库安全策略包含哪些
海淀数据库安全审计系统
建立农村房屋安全信息数据库
易用的数据库客户端支持安全管理
连接数据库失败ssl安全错误
数据库的锁怎样保障安全
济南量化交易软件开发
创建维护数据库的是什么
提取 多行对应数据库
eda底层数据库
怎么看lol哪个服务器有角色
易语言edb数据库如何相加
专科软件开发在深圳好就业吗
网络安全的可视化
卓资县网络安全
数据库配套软件
绵阳展厅多媒体软件开发
软件开发人员报价一天多少钱
wind数据库波动率
女子能不能做软件开发
创建关系数据库表格的sql命令
解析omim数据库
ecs目标服务器管理器
网络安全培训合作合同
如何查看阿里云购买的服务器
软件开发瀑布模型的含义
数据库新技术讲解
美版有锁导入数据库
地理数据库 设计 原则
下八庙服务器
小飞数据库
常用的人脸数据库
网络安全技术支撑单位作用
互联网视觉科技有限公司
esi数据库类型
兰州石化网络技术211班