gpt4 book ai didi

org.apache.zookeeper.ZooKeeper.getChildWatches()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-17 15:00:40 27 4
gpt4 key购买 nike

本文整理了Java中org.apache.zookeeper.ZooKeeper.getChildWatches()方法的一些代码示例,展示了ZooKeeper.getChildWatches()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZooKeeper.getChildWatches()方法的具体详情如下:
包路径:org.apache.zookeeper.ZooKeeper
类名称:ZooKeeper
方法名:getChildWatches

ZooKeeper.getChildWatches介绍

暂无

代码示例

代码示例来源:origin: apache/zookeeper

List<String> dataWatches = zooKeeper.getDataWatches();
List<String> existWatches = zooKeeper.getExistWatches();
List<String> childWatches = zooKeeper.getChildWatches();
if (!dataWatches.isEmpty()
    || !existWatches.isEmpty() || !childWatches.isEmpty()) {

代码示例来源:origin: apache/zookeeper

/**
 * Test verifies deletion of NodeChildrenChanged watches
 */
@Test(timeout = 30000)
public void testRemoveNodeChildrenChangedWatches() throws Exception {
  List<EventType> expectedEvents = new ArrayList<Watcher.Event.EventType>();
  expectedEvents.add(EventType.ChildWatchRemoved);
  MyWatcher myWatcher = new MyWatcher("/testnode1", expectedEvents, 1);
  zk.create("/testnode1", "data".getBytes(), Ids.OPEN_ACL_UNSAFE,
      CreateMode.PERSISTENT);
  LOG.info("Adding child changed watcher");
  zk.getChildren("/testnode1", myWatcher);
  String cmdstring = "removewatches /testnode1 -c";
  LOG.info("Remove watchers using shell command : {}", cmdstring);
  zkMain.cl.parseCommand(cmdstring);
  Assert.assertTrue("Removewatches cmd fails to remove child watches",
      zkMain.processZKCmd(zkMain.cl));
  myWatcher.matches();
  Assert.assertEquals(
      "Failed to remove child watches : " + zk.getChildWatches(), 0,
      zk.getChildWatches().size());
}

代码示例来源:origin: apache/zookeeper

myWatcher.matches();
Assert.assertEquals(
    "Failed to remove child watches : " + zk.getChildWatches(), 1,
    zk.getChildWatches().size());
    "Failed to remove child watches :" + zk.getChildWatches(), zk
        .getChildWatches().contains("/testnode1/testnode2"));

代码示例来源:origin: org.apache.zookeeper/zookeeper

List<String> dataWatches = zooKeeper.getDataWatches();
List<String> existWatches = zooKeeper.getExistWatches();
List<String> childWatches = zooKeeper.getChildWatches();
if (!dataWatches.isEmpty()
      || !existWatches.isEmpty() || !childWatches.isEmpty()) {

代码示例来源:origin: apache/zookeeper

.getChildWatches().contains("/testnode2"));
Assert.assertTrue("Failed to find data watches for the path testnode2",
    zk.getDataWatches().contains("/testnode2"));

代码示例来源:origin: apache/zookeeper

.getChildWatches().size());
for (int i = 0; i < count; i++) {
  final MyWatcher watcher = wList.get(i);
    .getChildWatches().size());

代码示例来源:origin: apache/zookeeper

.getChildWatches().size());
    .getChildWatches().size());
Assert.assertEquals("Didn't remove watch references!", 0, zk1
    .getDataWatches().size());

代码示例来源:origin: apache/zookeeper

Assert.assertTrue("Didn't remove child watcher", w1.matches());
Assert.assertEquals("Didn't find child watcher", 1, zk2
    .getChildWatches().size());
removeWatches(zk2, "/node1", w2, WatcherType.Any, false, Code.OK);
Assert.assertTrue("Didn't remove child watcher", w2.matches());

代码示例来源:origin: apache/zookeeper

/**
 * Test verifies WatcherType.Any - removes only the configured child watcher
 * function
 */
@Test(timeout = 90000)
public void testRemoveAnyChildWatcher() throws Exception {
  zk1.create("/node1", null, Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
  MyWatcher w1 = new MyWatcher("/node1", 2);
  MyWatcher w2 = new MyWatcher("/node1", 1);
  LOG.info("Adding data watcher {} on path {}", new Object[] { w1,
      "/node1" });
  Assert.assertNotNull("Didn't set data watches",
      zk2.exists("/node1", w1));
  // Add multiple child watches
  LOG.info("Adding child watcher {} on path {}", new Object[] { w1,
      "/node1" });
  zk2.getChildren("/node1", w2);
  LOG.info("Adding child watcher {} on path {}", new Object[] { w2,
      "/node1" });
  zk2.getChildren("/node1", w1);
  removeWatches(zk2, "/node1", w2, WatcherType.Any, false, Code.OK);
  Assert.assertTrue("Didn't remove child watcher", w2.matches());
  Assert.assertEquals("Didn't find child watcher", 1, zk2
      .getChildWatches().size());
  Assert.assertEquals("Didn't find data watcher", 1, zk2
      .getDataWatches().size());
  removeWatches(zk2, "/node1", w1, WatcherType.Any, false, Code.OK);
  Assert.assertTrue("Didn't remove watchers", w1.matches());
}

代码示例来源:origin: apache/zookeeper

Assert.assertTrue("Didn't remove data watcher", w1.matches());
Assert.assertEquals("Didn't find child watcher", 1, zk2
    .getChildWatches().size());
Assert.assertEquals("Didn't find data watcher", 1, zk2
    .getDataWatches().size());

代码示例来源:origin: apache/zookeeper

Assert.assertTrue("Didn't remove child watcher", w2.matches());
Assert.assertEquals("Didn't find child watcher", 1, zk2
    .getChildWatches().size());
removeWatches(zk2, "/node1", w1, WatcherType.Any, false, Code.OK);
Assert.assertTrue("Didn't remove child watcher", w1.matches());

代码示例来源:origin: org.apache.hadoop/zookeeper

(!zooKeeper.getDataWatches().isEmpty()
   || !zooKeeper.getExistWatches().isEmpty()
   || !zooKeeper.getChildWatches().isEmpty()))
    zooKeeper.getChildWatches());
RequestHeader h = new RequestHeader();
h.setType(ZooDefs.OpCode.setWatches);

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com