gpt4 book ai didi

org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher.registerListener()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-15 01:38:49 28 4
gpt4 key购买 nike

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

ZooKeeperWatcher.registerListener介绍

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

代码示例

代码示例来源:origin: harbby/presto-connectors

/**
 * @param watcher
 * @param sn ServerName
 * @param master In an instance of a Master.
 */
ActiveMasterManager(ZooKeeperWatcher watcher, ServerName sn, Server master) {
 super(watcher);
 watcher.registerListener(this);
 this.sn = sn;
 this.master = master;
}

代码示例来源:origin: harbby/presto-connectors

/**
 * Construct a ZooKeeper event listener.
 */
public RecoveringRegionWatcher(ZooKeeperWatcher watcher, HRegionServer server) {
 super(watcher);
 watcher.registerListener(this);
 this.server = server;
}

代码示例来源:origin: co.cask.hbase/hbase

public void registerRegionServerListener(ZooKeeperListener listener) {
 this.zookeeper.registerListener(listener);
}

代码示例来源:origin: harbby/presto-connectors

@Override
public void registerListener() {
 watcher.registerListener(this);
}

代码示例来源:origin: XiaoMi/themis

public void start() throws KeeperException, IOException {
 watcher.registerListener(this);
 loadAliveClients();
}

代码示例来源:origin: harbby/presto-connectors

public ReplicationTrackerZKImpl(ZooKeeperWatcher zookeeper,
  final ReplicationPeers replicationPeers, Configuration conf, Abortable abortable,
  Stoppable stopper) {
 super(zookeeper, conf, abortable);
 this.replicationPeers = replicationPeers;
 this.stopper = stopper;
 this.zookeeper.registerListener(new OtherRegionServerWatcher(this.zookeeper));
 this.zookeeper.registerListener(new PeersWatcher(this.zookeeper));
}

代码示例来源:origin: harbby/presto-connectors

@Override
public void init() throws IOException {
 this.zkretries = conf.getLong("hbase.splitlog.zk.retries", DEFAULT_ZK_RETRIES);
 this.resubmitThreshold = conf.getLong("hbase.splitlog.max.resubmit", DEFAULT_MAX_RESUBMIT);
 this.timeout = conf.getInt(HConstants.HBASE_SPLITLOG_MANAGER_TIMEOUT, DEFAULT_TIMEOUT);
 setRecoveryMode(true);
 if (this.watcher != null) {
  this.watcher.registerListener(this);
  lookForOrphans();
 }
}

代码示例来源:origin: com.aliyun.hbase/alihbase-client

private void init(){
  try {
    ZKUtil2.createWithParents(watcher, node);
  } catch (KeeperException e) {
    LOG.warn("create vhost root node failed, pub-network still disabled.", e);
    return;
  }
  this.watcher.registerListener(this);
  updateVhostMap();
}

代码示例来源:origin: harbby/presto-connectors

private TableHFileArchiveTracker(ZooKeeperWatcher watcher, HFileArchiveTableMonitor monitor) {
 super(watcher);
 watcher.registerListener(this);
 this.monitor = monitor;
 this.archiveHFileZNode = ZKTableArchiveClient.getArchiveZNode(watcher.getConfiguration(),
  watcher);
}

代码示例来源:origin: harbby/presto-connectors

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

代码示例来源:origin: co.cask.hbase/hbase

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

代码示例来源:origin: co.cask.hbase/hbase

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

代码示例来源:origin: harbby/presto-connectors

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

代码示例来源:origin: harbby/presto-connectors

public void start() throws KeeperException {
 try {
  watcher.registerListener(this);
  if (ZKUtil.watchAndCheckExists(watcher, aclZNode)) {
   List<ZKUtil.NodeAndData> existing =
     ZKUtil.getChildDataAndWatchForNewChildren(watcher, aclZNode);
   if (existing != null) {
    refreshNodes(existing);
   }
  }
 } finally {
  initialized.countDown();
 }
}

代码示例来源:origin: co.cask.hbase/hbase

public void finishInitialization(boolean masterRecovery) {
 if (!masterRecovery) {
  Threads.setDaemonThreadRunning(timeoutMonitor.getThread(), serverName
    + ".splitLogManagerTimeoutMonitor");
 }
 // Watcher can be null during tests with Mock'd servers.
 if (this.watcher != null) {
  this.watcher.registerListener(this);
  lookForOrphans();
 }
}

代码示例来源:origin: harbby/presto-connectors

public void start() throws KeeperException {
 watcher.registerListener(this);
 // make sure the base node exists
 ZKUtil.createWithParents(watcher, keysParentZNode);
 if (ZKUtil.watchAndCheckExists(watcher, keysParentZNode)) {
  List<ZKUtil.NodeAndData> nodes =
    ZKUtil.getChildDataAndWatchForNewChildren(watcher, keysParentZNode);
  refreshNodes(nodes);
 }
}

代码示例来源:origin: co.cask.hbase/hbase

public void start() {
 try {
  watcher.registerListener(this);
  String parent = ZKUtil.getParent(leaderZNode);
  if (ZKUtil.checkExists(watcher, parent) < 0) {
   ZKUtil.createWithParents(watcher, parent);
  }
 } catch (KeeperException ke) {
  watcher.abort("Unhandled zk exception when starting", ke);
  candidate.stop("Unhandled zk exception starting up: "+ke.getMessage());
 }
}

代码示例来源:origin: harbby/presto-connectors

public void start() {
 try {
  watcher.registerListener(this);
  String parent = ZKUtil.getParent(leaderZNode);
  if (ZKUtil.checkExists(watcher, parent) < 0) {
   ZKUtil.createWithParents(watcher, parent);
  }
 } catch (KeeperException ke) {
  watcher.abort("Unhandled zk exception when starting", ke);
  candidate.stop("Unhandled zk exception starting up: "+ke.getMessage());
 }
}

代码示例来源:origin: harbby/presto-connectors

/**
 * Closes the current ZKW (if not null) and creates a new one
 * @throws IOException If anything goes wrong connecting
 */
void reloadZkWatcher() throws IOException {
 if (zkw != null) zkw.close();
 zkw = new ZooKeeperWatcher(ctx.getConfiguration(),
   "connection to cluster: " + ctx.getPeerId(), this);
 getZkw().registerListener(new PeerRegionServerListener(this));
}

代码示例来源:origin: harbby/presto-connectors

public void start() throws KeeperException {
 watcher.registerListener(this);
 ZKUtil.createWithParents(watcher, labelZnode);
 ZKUtil.createWithParents(watcher, userAuthsZnode);
 byte[] data = ZKUtil.getDataAndWatch(watcher, labelZnode);
 if (data != null && data.length > 0) {
  refreshVisibilityLabelsCache(data);
 }
 data = ZKUtil.getDataAndWatch(watcher, userAuthsZnode);
 if (data != null && data.length > 0) {
  refreshUserAuthsCache(data);
 }
}

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