gpt4 book ai didi

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

转载 作者:知者 更新时间:2024-03-17 14:58:40 28 4
gpt4 key购买 nike

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

ZooKeeper.removeAllWatches介绍

[英]For the given znode path, removes all the registered watchers of given watcherType.

A successful call guarantees that, the removed watchers won't be triggered.
[中]对于给定的znode路径,删除给定watcherType的所有已注册观察程序。
一个成功的呼叫保证,被移除的监视程序不会被触发。

代码示例

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

@Override
  public boolean exec() throws CliWrapperException, MalformedPathException {
    String path = args[1];
    WatcherType wtype = WatcherType.Any;
    // if no matching option -c or -d or -a is specified, we remove
    // the watches of the given node by choosing WatcherType.Any
    if (cl.hasOption("c")) {
      wtype = WatcherType.Children;
    } else if (cl.hasOption("d")) {
      wtype = WatcherType.Data;
    } else if (cl.hasOption("a")) {
      wtype = WatcherType.Any;
    }
    // whether to remove the watches locally
    boolean local = cl.hasOption("l");

    try {
      zk.removeAllWatches(path, wtype, local);
    } catch (IllegalArgumentException ex) {
      throw new MalformedPathException(ex.getMessage());
    } catch (KeeperException|InterruptedException ex) {
      throw new CliWrapperException(ex);
    }
    return true;
  }
}

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

private void removeAllWatches(ZooKeeper zk, String path,
    WatcherType watcherType, boolean local, KeeperException.Code rc)
    throws InterruptedException, KeeperException {
  LOG.info("Sending removeWatches req using zk {} path: {} type: {} ",
      new Object[] { zk, path, watcherType });
  if (useAsync) {
    MyCallback c1 = new MyCallback(rc.intValue(), path);
    zk.removeAllWatches(path, watcherType, local, c1, null);
    Assert.assertTrue("Didn't succeeds removeWatch operation",
        c1.matches());
    if (KeeperException.Code.OK.intValue() != c1.rc) {
      KeeperException ke = KeeperException
          .create(KeeperException.Code.get(c1.rc));
      throw ke;
    }
  } else {
    zk.removeAllWatches(path, watcherType, local);
  }
}

代码示例来源:origin: org.apache.curator/curator-framework

zkClient.removeAllWatches(path, watcherType, local);

代码示例来源:origin: org.apache.curator/curator-framework

if(namespaceWatcher == null)
  zkClient.removeAllWatches(operationAndData.getData(), watcherType, local, callback, operationAndData.getContext());

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