com.alibaba.wasp.zookeeper.ZooKeeperWatcher.registerListener()方法的使用及代码示例

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

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

ZooKeeperWatcher.registerListener介绍

[英]Register the specified listener to receive ZooKeeper events.
[中]注册指定的侦听器以接收ZooKeeper事件。

代码示例

代码示例来源:origin: alibaba/wasp

/**
 * Starts the tracking of draining fServers.
 *
 * <p>All Draining RSs will be tracked after this method is called.
 *
 * @throws org.apache.zookeeper.KeeperException
 */
public void start() throws KeeperException, IOException {
 watcher.registerListener(this);
 List<String> servers =
  ZKUtil.listChildrenAndWatchThem(watcher, watcher.drainingZNode);
 add(servers);
}

代码示例来源:origin: alibaba/wasp

/**
 * Starts the tracking of online FServers.
 *
 * <p>
 * All RSs will be tracked after this method is called.
 *
 * @throws org.apache.zookeeper.KeeperException
 * @throws java.io.IOException
 */
public void start() throws KeeperException, IOException {
 watcher.registerListener(this);
 List<String> servers = ZKUtil.listChildrenAndWatchThem(watcher,
   watcher.fsZNode);
 add(servers);
}

代码示例来源:origin: alibaba/wasp

+ " interuppted while waiting for SASL Authentication", e);
this.watcher.registerListener(this);
try {
 if (ZKUtil.watchAndCheckExists(watcher, node)) {

代码示例来源:origin: alibaba/wasp

public DummyMaster(ZooKeeperWatcher zk, ServerName master) {
 this.clusterStatusTracker = new ClusterStatusTracker(zk, this);
 clusterStatusTracker.start();
 this.activeMasterManager = new ActiveMasterManager(zk, master, this);
 zk.registerListener(activeMasterManager);
}

代码示例来源:origin: alibaba/wasp

/**
 * Try becoming active master.
 * 
 * @param startupStatus
 * @return True if we could successfully become the active master.
 * @throws InterruptedException
 */
private boolean becomeActiveMaster(MonitoredTask startupStatus)
  throws InterruptedException {
 this.activeMasterManager = new ActiveMasterManager(zooKeeper,
   this.serverName, this);
 this.zooKeeper.registerListener(activeMasterManager);
 stallIfBackupMaster(this.conf, this.activeMasterManager);
 // The ClusterStatusTracker is setup before the other
 // ZKBasedSystemTrackers because it's needed by the activeMasterManager
 // to check if the cluster should be shutdown.
 this.clusterStatusTracker = new ClusterStatusTracker(getZooKeeper(), this);
 this.clusterStatusTracker.start();
 return this.activeMasterManager.blockUntilBecomingActiveMaster(
   startupStatus, this.clusterStatusTracker);
}

代码示例来源:origin: alibaba/wasp

zk.registerListener(listener);

相关文章