gpt4 book ai didi

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

转载 作者:知者 更新时间:2024-03-15 16:00:40 26 4
gpt4 key购买 nike

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

ZKWatcher.getZNodePaths介绍

[英]Get the znodePaths.

Mainly used for mocking as mockito can not mock a field access.
[中]去拿那条路。
主要用于模拟,因为mockito无法模拟字段访问。

代码示例

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

/**
 * Creates a cluster status tracker.
 *
 * <p>After construction, use {@link #start} to kick off tracking.
 *
 * @param watcher reference to the {@link ZKWatcher} which also contains configuration and
 *                constants
 * @param abortable used to abort if a fatal error occurs
 */
public ClusterStatusTracker(ZKWatcher watcher, Abortable abortable) {
 super(watcher, watcher.getZNodePaths().clusterStateZNode, abortable);
}

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

private boolean refreshListIfRightPath(String path) {
  if (!path.startsWith(this.watcher.getZNodePaths().rsZNode)) {
   return false;
  }
  return refreshOtherRegionServersList(true);
 }
}

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

/**
  * @param conf conf to read for the base archive node
  * @param zooKeeper zookeeper to used for building the full path
  * @return get the znode for long-term archival of a table for
  */
 public static String getArchiveZNode(Configuration conf, ZKWatcher zooKeeper) {
  return ZNodePaths.joinZNode(zooKeeper.getZNodePaths().baseZNode, conf.get(
   ZOOKEEPER_ZNODE_HFILE_ARCHIVE_KEY, TableHFileArchiveTracker.HFILE_ARCHIVE_ZNODE_PARENT));
 }
}

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

@Override
 Collection<String> getNodesToWatch() {
  return watcher.getZNodePaths().metaReplicaZNodes.values();
 }
}

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

protected ZKReplicationStorageBase(ZKWatcher zookeeper, Configuration conf) {
 this.zookeeper = zookeeper;
 this.conf = conf;
 this.replicationZNode = ZNodePaths.joinZNode(this.zookeeper.getZNodePaths().baseZNode,
  conf.get(REPLICATION_ZNODE, REPLICATION_ZNODE_DEFAULT));
}

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

private void update(String path) {
 if (path.startsWith(watcher.getZNodePaths().masterMaintZNode)) {
  update();
 }
}

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

public ZKVisibilityLabelWatcher(ZKWatcher watcher, VisibilityLabelsCache labelsCache,
                Configuration conf) {
 super(watcher);
 this.labelsCache = labelsCache;
 String labelZnodeParent = conf.get(VISIBILITY_LABEL_ZK_PATH, DEFAULT_VISIBILITY_LABEL_NODE);
 String userAuthsZnodeParent = conf.get(VISIBILITY_USER_AUTHS_ZK_PATH,
   DEFAULT_VISIBILITY_USER_AUTHS_NODE);
 this.labelZnode = ZNodePaths.joinZNode(watcher.getZNodePaths().baseZNode, labelZnodeParent);
 this.userAuthsZnode = ZNodePaths.joinZNode(watcher.getZNodePaths().baseZNode,
     userAuthsZnodeParent);
}

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

@Override
 public void nodeChildrenChanged(String path) {
  if (path.equals(watcher.getZNodePaths().rsZNode) && !server.isAborted() &&
   !server.isStopped()) {
   executor.execute(this::refresh);
  }
 }
}

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

public ZKSecretWatcher(Configuration conf,
  ZKWatcher watcher,
  AuthenticationTokenSecretManager secretManager) {
 super(watcher);
 this.secretManager = secretManager;
 String keyZNodeParent = conf.get("zookeeper.znode.tokenauth.parent", DEFAULT_ROOT_NODE);
 this.baseKeyZNode = ZNodePaths.joinZNode(watcher.getZNodePaths().baseZNode, keyZNodeParent);
 this.keysParentZNode = ZNodePaths.joinZNode(baseKeyZNode, DEFAULT_KEYS_PARENT);
}

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

void handle(final String path) {
 if (path.equals(watcher.getZNodePaths().masterAddressZNode) && !master.isStopped()) {
  handleMasterNodeChange();
 }
}

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

private static void resetAcls(final Configuration conf, boolean eraseAcls)
  throws Exception {
 ZKWatcher zkw = new ZKWatcher(conf, "ZKAclReset", null);
 try {
  LOG.info((eraseAcls ? "Erase" : "Set") + " HBase ACLs for " +
       zkw.getQuorum() + " " + zkw.getZNodePaths().baseZNode);
  resetAcls(zkw, zkw.getZNodePaths().baseZNode, eraseAcls);
 } finally {
  zkw.close();
 }
}

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

/**
 * Gets the full path node name for the log file being split.
 * This method will url encode the filename.
 * @param zkw zk reference
 * @param filename log file name (only the basename)
 */
public static String getEncodedNodeName(ZKWatcher zkw, String filename) {
 return ZNodePaths.joinZNode(zkw.getZNodePaths().splitLogZNode, encode(filename));
}

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

public PeerRegionServerListener(HBaseReplicationEndpoint replicationPeer) {
 super(replicationPeer.getZkw());
 this.replicationEndpoint = replicationPeer;
 this.regionServerListNode = replicationEndpoint.getZkw().getZNodePaths().rsZNode;
}

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

@VisibleForTesting
protected String getTableCFsNode(String peerId) {
 String replicationZNode = ZNodePaths.joinZNode(zookeeper.getZNodePaths().baseZNode,
  conf.get(REPLICATION_ZNODE, REPLICATION_ZNODE_DEFAULT));
 String peersZNode =
   ZNodePaths.joinZNode(replicationZNode, conf.get(PEERS_ZNODE, PEERS_ZNODE_DEFAULT));
 return ZNodePaths.joinZNode(peersZNode,
  ZNodePaths.joinZNode(peerId, conf.get(TABLE_CFS_ZNODE, TABLE_CFS_ZNODE_DEFAULT)));
}

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

private void testZNodeACLs() throws IOException, KeeperException, InterruptedException {
 ZKWatcher watcher = new ZKWatcher(conf, "IntegrationTestZnodeACLs", null);
 RecoverableZooKeeper zk = ZKUtil.connect(this.conf, watcher);
 String baseZNode = watcher.getZNodePaths().baseZNode;
 LOG.info("");
 LOG.info("***********************************************************************************");
 LOG.info("Checking ZK permissions, root znode: " + baseZNode);
 LOG.info("***********************************************************************************");
 LOG.info("");
 checkZnodePermsRecursive(watcher, zk, baseZNode);
 LOG.info("Checking ZK permissions: SUCCESS");
}

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

private static void waitUntilZnodeAvailable(int replicaId) throws Exception {
 String znode = util.getZooKeeperWatcher().getZNodePaths().getZNodeForReplica(replicaId);
 int i = 0;
 while (i < 1000) {
  if (ZKUtil.checkExists(util.getZooKeeperWatcher(), znode) == -1) {
   Thread.sleep(100);
   i++;
  } else break;
 }
 if (i == 1000) throw new IOException("znode for meta replica " + replicaId + " not available");
}

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

@Before
public void setUp() throws Exception {
 Configuration conf = testUtil.getConfiguration();
 conf.set(HConstants.MASTER_PORT, "0");
 conf.setInt(HConstants.ZK_SESSION_TIMEOUT, 2000);
 testUtil.startMiniZKCluster();
 ZKWatcher watcher = testUtil.getZooKeeperWatcher();
 ZKUtil.createWithParents(watcher, watcher.getZNodePaths().masterAddressZNode,
     Bytes.toBytes("fake:123"));
 master = new HMaster(conf);
 rpcClient = RpcClientFactory.createClient(conf, HConstants.CLUSTER_ID_DEFAULT);
}

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

private static String initPeerClusterState(String baseZKNode)
  throws IOException, KeeperException {
 // Add a dummy region server and set up the cluster id
 Configuration testConf = new Configuration(conf);
 testConf.set(HConstants.ZOOKEEPER_ZNODE_PARENT, baseZKNode);
 ZKWatcher zkw1 = new ZKWatcher(testConf, "test1", null);
 String fakeRs = ZNodePaths.joinZNode(zkw1.getZNodePaths().rsZNode,
     "hostname1.example.org:1234");
 ZKUtil.createWithParents(zkw1, fakeRs);
 ZKClusterId.setClusterId(zkw1, new ClusterId());
 return ZKConfig.getZooKeeperClusterKey(testConf);
}

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

@BeforeClass
public static void setUpBeforeClass() throws Exception {
 utility = new HBaseZKTestingUtility();
 utility.startMiniZKCluster();
 conf = utility.getConfiguration();
 conf.setBoolean(HConstants.REPLICATION_BULKLOAD_ENABLE_KEY, true);
 zkw = utility.getZooKeeperWatcher();
 String replicationZNodeName = conf.get("zookeeper.znode.replication", "replication");
 replicationZNode = ZNodePaths.joinZNode(zkw.getZNodePaths().baseZNode, replicationZNodeName);
 KEY_ONE = initPeerClusterState("/hbase1");
 KEY_TWO = initPeerClusterState("/hbase2");
}

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

@BeforeClass
public static void setUpBeforeClass() throws Exception {
 utility = new HBaseTestingUtility();
 utility.startMiniZKCluster();
 conf = utility.getConfiguration();
 ZKWatcher zk = HBaseTestingUtility.getZooKeeperWatcher(utility);
 ZKUtil.createWithParents(zk, zk.getZNodePaths().rsZNode);
}

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