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

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

本文整理了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

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

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

/**
 * Gets the full path node name for the unassigned node for the specified
 * region.
 * @param zkw zk reference
 * @param regionName region name
 * @return full path node name
 */
public static String getNodeName(ZooKeeperWatcher zkw, String regionName) {
 return ZKUtil.joinZNode(zkw.assignmentZNode, regionName);
}

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

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

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

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

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

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

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

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

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

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

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

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

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

public ZKVisibilityLabelWatcher(ZooKeeperWatcher 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 = ZKUtil.joinZNode(watcher.baseZNode, labelZnodeParent);
 this.userAuthsZnode = ZKUtil.joinZNode(watcher.baseZNode, userAuthsZnodeParent);
}

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

/**
 * Add a new log to the list of hlogs in zookeeper
 * @param filename name of the hlog's znode
 * @param peerId name of the cluster's znode
 */
public void addLogToList(String filename, String peerId)
 throws KeeperException {
 String znode = ZKUtil.joinZNode(this.rsServerNameZnode, peerId);
 znode = ZKUtil.joinZNode(znode, filename);
 ZKUtil.createWithParents(this.zookeeper, znode);
}

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

/**
 * Set the new replication state for this cluster
 * @param newState
 */
public void setReplicating(boolean newState) throws KeeperException {
 ZKUtil.createWithParents(this.zookeeper,
   ZKUtil.joinZNode(this.replicationZNode, this.replicationStateNodeName));
 ZKUtil.setData(this.zookeeper,
   ZKUtil.joinZNode(this.replicationZNode, this.replicationStateNodeName),
   Bytes.toBytes(Boolean.toString(newState)));
}

代码示例来源:origin: co.cask.hbase/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(ZooKeeperWatcher zkw,
  String filename) {
  return ZKUtil.joinZNode(zkw.splitLogZNode, encode(filename));
}

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

/**
 * Creates a meta node tracker.
 * @param watcher
 * @param abortable
 */
public MetaNodeTracker(final ZooKeeperWatcher watcher, final Abortable abortable) {
 super(watcher, ZKUtil.joinZNode(watcher.assignmentZNode,
   HRegionInfo.FIRST_META_REGIONINFO.getEncodedName()), abortable);
}

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

@Override
public void addLog(String queueId, String filename) throws ReplicationException {
 String znode = ZKUtil.joinZNode(this.myQueuesZnode, queueId);
 znode = ZKUtil.joinZNode(znode, filename);
 try {
  ZKUtil.createWithParents(this.zookeeper, znode);
 } catch (KeeperException e) {
  throw new ReplicationException(
    "Could not add log because znode could not be created. queueId=" + queueId
      + ", filename=" + filename);
 }
}

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

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

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

@Override
public List<String> getAllQueues(String serverName) throws KeeperException {
 String znode = ZKUtil.joinZNode(this.queuesZNode, serverName);
 List<String> result = null;
 try {
  result = ZKUtil.listChildrenNoWatch(this.zookeeper, znode);
 } catch (KeeperException e) {
  this.abortable.abort("Failed to get list of queues for serverName=" + serverName, e);
  throw e;
 }
 return result;
}

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

@Override
public void removePeer(String id) throws ReplicationException {
 try {
  if (!peerExists(id)) {
   throw new IllegalArgumentException("Cannot remove peer with id=" + id
     + " because that id does not exist.");
  }
  ZKUtil.deleteNodeRecursively(this.zookeeper, ZKUtil.joinZNode(this.peersZNode, id));
 } catch (KeeperException e) {
  throw new ReplicationException("Could not remove peer with id=" + id, e);
 }
}

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

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

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

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

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

public void visitAllLocks(MetadataHandler handler) throws IOException {
 for (String tableName : getTableNames()) {
  String tableLockZNode = ZKUtil.joinZNode(zkWatcher.tableLockZNode, tableName);
  ZKInterProcessReadWriteLock lock = new ZKInterProcessReadWriteLock(
    zkWatcher, tableLockZNode, null);
  lock.readLock(null).visitLocks(handler);
  lock.writeLock(null).visitLocks(handler);
 }
}

相关文章

微信公众号

最新文章

更多