com.twitter.finagle.common.zookeeper.ZooKeeperClient.unregister()方法的使用及代码示例

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

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

ZooKeeperClient.unregister介绍

[英]Clients can attempt to unregister a top-level Watcher that has previously been registered.
[中]客户端可以尝试注销之前已注册的顶级监视程序。

代码示例

代码示例来源:origin: com.twitter/finagle-serversets_2.11

public Runnable watch() throws WatchException, InterruptedException {
 Watcher onExpirationWatcher = zkClient.registerExpirationHandler(new Runnable() {
  @Override public void run() {
   // Servers may have changed Status while we were disconnected from ZooKeeper, check and
   // re-register our node watches.
   rebuildServerSet();
  }
 });
 try {
  return group.watch(new GroupChangeListener() {
   @Override public void onGroupChange(Iterable<String> memberIds) {
    notifyGroupChange(memberIds);
   }
  });
 } catch (WatchException e) {
  zkClient.unregister(onExpirationWatcher);
  throw e;
 } catch (InterruptedException e) {
  zkClient.unregister(onExpirationWatcher);
  throw e;
 }
}

代码示例来源:origin: com.twitter/finagle-serversets

public Runnable watch() throws WatchException, InterruptedException {
 Watcher onExpirationWatcher = zkClient.registerExpirationHandler(new Runnable() {
  @Override public void run() {
   // Servers may have changed Status while we were disconnected from ZooKeeper, check and
   // re-register our node watches.
   rebuildServerSet();
  }
 });
 try {
  return group.watch(new GroupChangeListener() {
   @Override public void onGroupChange(Iterable<String> memberIds) {
    notifyGroupChange(memberIds);
   }
  });
 } catch (WatchException e) {
  zkClient.unregister(onExpirationWatcher);
  throw e;
 } catch (InterruptedException e) {
  zkClient.unregister(onExpirationWatcher);
  throw e;
 }
}

相关文章