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

x33g5p2x  于2022-02-05 转载在 其他  
字(3.0k)|赞(0)|评价(0)|浏览(239)

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

ZooKeeper.removeWatches介绍

[英]For the given znode path, removes the specified watcher of given watcherType.

Watcher shouldn't be null. A successful call guarantees that, the removed watcher won't be triggered.
[中]对于给定的znode路径,删除给定watcherType的指定观察者。
观察者不应该为空。成功的呼叫保证不会触发被移除的观察者。

代码示例

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

/**
 * The asynchronous version of removeAllWatches.
 *
 * @see #removeAllWatches
 */
public void removeAllWatches(String path, WatcherType watcherType,
    boolean local, VoidCallback cb, Object ctx) {
  removeWatches(ZooDefs.OpCode.removeWatches, path, null,
      watcherType, local, cb, ctx);
}

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

boolean local) throws InterruptedException, KeeperException {
removeWatches(ZooDefs.OpCode.removeWatches, path, null, watcherType,
    local);

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

/**
 * The asynchronous version of removeWatches.
 *
 * @see #removeWatches
 */
public void removeWatches(String path, Watcher watcher,
    WatcherType watcherType, boolean local, VoidCallback cb, Object ctx) {
  validateWatcher(watcher);
  removeWatches(ZooDefs.OpCode.checkWatches, path, watcher,
      watcherType, local, cb, ctx);
}

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

throws InterruptedException, KeeperException {
validateWatcher(watcher);
removeWatches(ZooDefs.OpCode.checkWatches, path, watcher,
    watcherType, local);

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

/**
 * Test verifies null watcher
 */
@Test(timeout = 30000)
public void testNullWatcherReference() throws Exception {
  zk1.create("/node1", null, Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
  try {
    if (useAsync) {
      zk1.removeWatches("/node1", null, WatcherType.Data, false,
          null, null);
    } else {
      zk1.removeWatches("/node1", null, WatcherType.Data, false);
    }
    Assert.fail("Must throw IllegalArgumentException as watcher is null!");
  } catch (IllegalArgumentException iae) {
    // expected
  }
}

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

private void removeWatches(ZooKeeper zk, String path, Watcher watcher,
    WatcherType watcherType, boolean local, KeeperException.Code rc)
    throws InterruptedException, KeeperException {
  LOG.info(
      "Sending removeWatches req using zk {} path: {} type: {} watcher: {} ",
      new Object[] { zk, path, watcherType, watcher });
  if (useAsync) {
    MyCallback c1 = new MyCallback(rc.intValue(), path);
    zk.removeWatches(path, watcher, 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.removeWatches(path, watcher, watcherType, local);
  }
}

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

if ( namespaceWatcher != null )
  zkClient.removeWatches(path, namespaceWatcher, watcherType, local);

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

zkClient.removeWatches(operationAndData.getData(), namespaceWatcher, watcherType, local, callback, operationAndData.getContext());

相关文章