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

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

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

ZKUtil.joinZNode介绍

[英]Join the prefix znode name with the suffix znode name to generate a proper full znode name. Assumes prefix does not end with slash and suffix does not begin with it.
[中]将前缀znode name与后缀znode name连接起来,以生成正确的znode全名。假设前缀不以斜杠结尾,后缀不以斜杠开头。

代码示例

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

  1. /**
  2. * Get the full znode path for the node used by the coordinator or member to trigger an abort
  3. * of the global barrier acquisition or execution in subprocedures.
  4. * @param controller controller running the procedure
  5. * @param opInstanceName name of the running procedure instance (not the procedure description).
  6. * @return full znode path to the abort znode
  7. */
  8. public static String getAbortNode(ZKProcedureUtil controller, String opInstanceName) {
  9. return ZKUtil.joinZNode(controller.abortZnode, opInstanceName);
  10. }

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

  1. /**
  2. * Gets the full path node name for the unassigned node for the specified
  3. * region.
  4. * @param zkw zk reference
  5. * @param regionName region name
  6. * @return full path node name
  7. */
  8. public static String getNodeName(ZooKeeperWatcher zkw, String regionName) {
  9. return ZKUtil.joinZNode(zkw.assignmentZNode, regionName);
  10. }

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

  1. /**
  2. * Get the full znode path for the node used by the coordinator to trigger a global barrier
  3. * execution and release on each subprocedure.
  4. * @param controller controller running the procedure
  5. * @param opInstanceName name of the running procedure instance (not the procedure description).
  6. * @return full znode path to the commit barrier
  7. */
  8. public static String getReachedBarrierNode(ZKProcedureUtil controller,
  9. String opInstanceName) {
  10. return ZKUtil.joinZNode(controller.reachedZnode, opInstanceName);
  11. }

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

  1. /**
  2. * Get the full znode path for the node used by the coordinator to trigger a global barrier
  3. * acquire on each subprocedure.
  4. * @param controller controller running the procedure
  5. * @param opInstanceName name of the running procedure instance (not the procedure description).
  6. * @return full znode path to the prepare barrier/start node
  7. */
  8. public static String getAcquireBarrierNode(ZKProcedureUtil controller,
  9. String opInstanceName) {
  10. return ZKUtil.joinZNode(controller.acquiredZnode, opInstanceName);
  11. }

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

  1. /**
  2. * Get the full znode path for the node used by the coordinator to trigger a global barrier
  3. * execution and release on each subprocedure.
  4. * @param controller controller running the procedure
  5. * @param opInstanceName name of the running procedure instance (not the procedure description).
  6. * @return full znode path to the commit barrier
  7. */
  8. public static String getReachedBarrierNode(ZKProcedureUtil controller,
  9. String opInstanceName) {
  10. return ZKUtil.joinZNode(controller.reachedZnode, opInstanceName);
  11. }

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

  1. /**
  2. * Get the full znode path for the node used by the coordinator or member to trigger an abort
  3. * of the global barrier acquisition or execution in subprocedures.
  4. * @param controller controller running the procedure
  5. * @param opInstanceName name of the running procedure instance (not the procedure description).
  6. * @return full znode path to the abort znode
  7. */
  8. public static String getAbortNode(ZKProcedureUtil controller, String opInstanceName) {
  9. return ZKUtil.joinZNode(controller.abortZnode, opInstanceName);
  10. }

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

  1. public ZKSecretWatcher(Configuration conf,
  2. ZooKeeperWatcher watcher,
  3. AuthenticationTokenSecretManager secretManager) {
  4. super(watcher);
  5. this.secretManager = secretManager;
  6. String keyZNodeParent = conf.get("zookeeper.znode.tokenauth.parent", DEFAULT_ROOT_NODE);
  7. this.baseKeyZNode = ZKUtil.joinZNode(watcher.baseZNode, keyZNodeParent);
  8. this.keysParentZNode = ZKUtil.joinZNode(baseKeyZNode, DEFAULT_KEYS_PARENT);
  9. }

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

  1. /**
  2. * Get the zookeeper node associated with archiving the given table
  3. * @param table name of the table to check
  4. * @return znode for the table's archive status
  5. */
  6. private String getTableNode(byte[] table) {
  7. return ZKUtil.joinZNode(archiveZnode, Bytes.toString(table));
  8. }
  9. }

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

  1. public ZKVisibilityLabelWatcher(ZooKeeperWatcher watcher, VisibilityLabelsCache labelsCache,
  2. Configuration conf) {
  3. super(watcher);
  4. this.labelsCache = labelsCache;
  5. String labelZnodeParent = conf.get(VISIBILITY_LABEL_ZK_PATH, DEFAULT_VISIBILITY_LABEL_NODE);
  6. String userAuthsZnodeParent = conf.get(VISIBILITY_USER_AUTHS_ZK_PATH,
  7. DEFAULT_VISIBILITY_USER_AUTHS_NODE);
  8. this.labelZnode = ZKUtil.joinZNode(watcher.baseZNode, labelZnodeParent);
  9. this.userAuthsZnode = ZKUtil.joinZNode(watcher.baseZNode, userAuthsZnodeParent);
  10. }

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

  1. /**
  2. * Add a new log to the list of hlogs in zookeeper
  3. * @param filename name of the hlog's znode
  4. * @param peerId name of the cluster's znode
  5. */
  6. public void addLogToList(String filename, String peerId)
  7. throws KeeperException {
  8. String znode = ZKUtil.joinZNode(this.rsServerNameZnode, peerId);
  9. znode = ZKUtil.joinZNode(znode, filename);
  10. ZKUtil.createWithParents(this.zookeeper, znode);
  11. }

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

  1. /**
  2. * Set the new replication state for this cluster
  3. * @param newState
  4. */
  5. public void setReplicating(boolean newState) throws KeeperException {
  6. ZKUtil.createWithParents(this.zookeeper,
  7. ZKUtil.joinZNode(this.replicationZNode, this.replicationStateNodeName));
  8. ZKUtil.setData(this.zookeeper,
  9. ZKUtil.joinZNode(this.replicationZNode, this.replicationStateNodeName),
  10. Bytes.toBytes(Boolean.toString(newState)));
  11. }

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

  1. /**
  2. * Gets the full path node name for the log file being split.
  3. * This method will url encode the filename.
  4. * @param zkw zk reference
  5. * @param filename log file name (only the basename)
  6. */
  7. public static String getEncodedNodeName(ZooKeeperWatcher zkw,
  8. String filename) {
  9. return ZKUtil.joinZNode(zkw.splitLogZNode, encode(filename));
  10. }

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

  1. /**
  2. * Creates a meta node tracker.
  3. * @param watcher
  4. * @param abortable
  5. */
  6. public MetaNodeTracker(final ZooKeeperWatcher watcher, final Abortable abortable) {
  7. super(watcher, ZKUtil.joinZNode(watcher.assignmentZNode,
  8. HRegionInfo.FIRST_META_REGIONINFO.getEncodedName()), abortable);
  9. }

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

  1. @Override
  2. public void addLog(String queueId, String filename) throws ReplicationException {
  3. String znode = ZKUtil.joinZNode(this.myQueuesZnode, queueId);
  4. znode = ZKUtil.joinZNode(znode, filename);
  5. try {
  6. ZKUtil.createWithParents(this.zookeeper, znode);
  7. } catch (KeeperException e) {
  8. throw new ReplicationException(
  9. "Could not add log because znode could not be created. queueId=" + queueId
  10. + ", filename=" + filename);
  11. }
  12. }

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

  1. private void deleteNamespace(String name) throws IOException {
  2. String zNode = ZKUtil.joinZNode(nsZNode, name);
  3. try {
  4. ZKUtil.deleteNode(watcher, zNode);
  5. } catch (KeeperException e) {
  6. LOG.error("Failed updating permissions for namespace "+name, e);
  7. throw new IOException("Failed updating permissions for namespace "+name, e);
  8. }
  9. }

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

  1. @Override
  2. public List<String> getAllQueues(String serverName) throws KeeperException {
  3. String znode = ZKUtil.joinZNode(this.queuesZNode, serverName);
  4. List<String> result = null;
  5. try {
  6. result = ZKUtil.listChildrenNoWatch(this.zookeeper, znode);
  7. } catch (KeeperException e) {
  8. this.abortable.abort("Failed to get list of queues for serverName=" + serverName, e);
  9. throw e;
  10. }
  11. return result;
  12. }

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

  1. @Override
  2. public void removePeer(String id) throws ReplicationException {
  3. try {
  4. if (!peerExists(id)) {
  5. throw new IllegalArgumentException("Cannot remove peer with id=" + id
  6. + " because that id does not exist.");
  7. }
  8. ZKUtil.deleteNodeRecursively(this.zookeeper, ZKUtil.joinZNode(this.peersZNode, id));
  9. } catch (KeeperException e) {
  10. throw new ReplicationException("Could not remove peer with id=" + id, e);
  11. }
  12. }

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

  1. public LeaderElector(ZooKeeperWatcher watcher, String serverName) {
  2. setDaemon(true);
  3. setName("ZKSecretWatcher-leaderElector");
  4. zkLeader = new ZKLeaderManager(watcher,
  5. ZKUtil.joinZNode(zkWatcher.getRootKeyZNode(), "keymaster"),
  6. Bytes.toBytes(serverName), this);
  7. }

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

  1. private void writeNamespace(NamespaceDescriptor ns) throws IOException {
  2. String zNode = ZKUtil.joinZNode(nsZNode, ns.getName());
  3. try {
  4. ZKUtil.createWithParents(watcher, zNode);
  5. ZKUtil.updateExistingNodeData(watcher, zNode,
  6. ProtobufUtil.toProtoNamespaceDescriptor(ns).toByteArray(), -1);
  7. } catch (KeeperException e) {
  8. LOG.error("Failed updating permissions for namespace "+ns.getName(), e);
  9. throw new IOException("Failed updating permissions for namespace "+ns.getName(), e);
  10. }
  11. }

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

  1. public void visitAllLocks(MetadataHandler handler) throws IOException {
  2. for (String tableName : getTableNames()) {
  3. String tableLockZNode = ZKUtil.joinZNode(zkWatcher.tableLockZNode, tableName);
  4. ZKInterProcessReadWriteLock lock = new ZKInterProcessReadWriteLock(
  5. zkWatcher, tableLockZNode, null);
  6. lock.readLock(null).visitLocks(handler);
  7. lock.writeLock(null).visitLocks(handler);
  8. }
  9. }

相关文章