gpt4 book ai didi

org.apache.twill.zookeeper.ZKClient.addConnectionWatcher()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-14 02:14:49 27 4
gpt4 key购买 nike

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

ZKClient.addConnectionWatcher介绍

[英]Adds a Watcher that will be called whenever connection state change.
[中]添加一个在连接状态更改时调用的观察程序。

代码示例

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

@Override
public Cancellable addConnectionWatcher(Watcher watcher) {
 return delegate.addConnectionWatcher(watcher);
}

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

@Override
public Cancellable addConnectionWatcher(Watcher watcher) {
 return delegate.addConnectionWatcher(watcher);
}

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

@Override
public Cancellable addConnectionWatcher(Watcher watcher) {
 return client.addConnectionWatcher(watcher);
}

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

@Override
public Cancellable addConnectionWatcher(Watcher watcher) {
 return delegate.addConnectionWatcher(watcher);
}

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

@Override
public Cancellable addConnectionWatcher(Watcher watcher) {
 return client.addConnectionWatcher(watcher);
}

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

@Override
public Cancellable addConnectionWatcher(Watcher watcher) {
 return delegate.addConnectionWatcher(watcher);
}

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

@Override
 public void run() {
  register();
  watcherCancellable = zkClient.addConnectionWatcher(wrapWatcher(new ConnectionWatcher()));
 }
});

代码示例来源:origin: caskdata/coopr

@Override
 public void run() {
  register();
  LeaderElection.this.zkClient.addConnectionWatcher(wrapWatcher(new ConnectionWatcher()));
 }
});

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

@Override
 public void run() {
  register();
  watcherCancellable = zkClient.addConnectionWatcher(wrapWatcher(new ConnectionWatcher()));
 }
});

代码示例来源:origin: org.apache.twill/twill-discovery-core

/**
 * Constructs ZKDiscoveryService using the provided zookeeper client for storing service registry under namespace.
 * @param zkClient of zookeeper quorum
 * @param namespace under which the service registered would be stored in zookeeper.
 *                  If namespace is {@code null}, no namespace will be used.
 */
public ZKDiscoveryService(ZKClient zkClient, String namespace) {
 this.closed = new AtomicBoolean();
 this.discoverables = HashMultimap.create();
 this.lock = new ReentrantLock();
 this.retryExecutor = Executors.newSingleThreadScheduledExecutor(
  Threads.createDaemonThreadFactory("zk-discovery-retry"));
 this.zkClient = namespace == null ? zkClient : ZKClients.namespace(zkClient, namespace);
 this.services = CacheBuilder.newBuilder()
  .removalListener(new RemovalListener<String, ServiceDiscoveredCacheEntry>() {
   @Override
   public void onRemoval(RemovalNotification<String, ServiceDiscoveredCacheEntry> notification) {
    ServiceDiscoveredCacheEntry entry = notification.getValue();
    if (entry != null) {
     entry.cancel();
    }
   }
  })
  .build(createServiceLoader());
 this.watcherCancellable = this.zkClient.addConnectionWatcher(createConnectionWatcher());
}

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

/**
 * Constructs ZKDiscoveryService using the provided zookeeper client for storing service registry under namespace.
 * @param zkClient of zookeeper quorum
 * @param namespace under which the service registered would be stored in zookeeper.
 *                  If namespace is {@code null}, no namespace will be used.
 */
public ZKDiscoveryService(ZKClient zkClient, String namespace) {
 this.closed = new AtomicBoolean();
 this.discoverables = HashMultimap.create();
 this.lock = new ReentrantLock();
 this.retryExecutor = Executors.newSingleThreadScheduledExecutor(
  Threads.createDaemonThreadFactory("zk-discovery-retry"));
 this.zkClient = namespace == null ? zkClient : ZKClients.namespace(zkClient, namespace);
 this.services = CacheBuilder.newBuilder()
  .removalListener(new RemovalListener<String, ServiceDiscoveredCacheEntry>() {
   @Override
   public void onRemoval(RemovalNotification<String, ServiceDiscoveredCacheEntry> notification) {
    ServiceDiscoveredCacheEntry entry = notification.getValue();
    if (entry != null) {
     entry.cancel();
    }
   }
  })
  .build(createServiceLoader());
 this.watcherCancellable = this.zkClient.addConnectionWatcher(createConnectionWatcher());
}

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

final Cancellable watcherCancellable = zkClient.addConnectionWatcher(new Watcher() {
 @Override
 public void process(WatchedEvent event) {

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

final Cancellable watcherCancellable = zkClient.addConnectionWatcher(new Watcher() {
 @Override
 public void process(WatchedEvent event) {

代码示例来源:origin: org.apache.twill/twill-core

watcherCancellable = zkClient.addConnectionWatcher(new Watcher() {
 private boolean expired = false;

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

watcherCancellable = zkClient.addConnectionWatcher(new Watcher() {
 private boolean expired = false;

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