gpt4 book ai didi

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

转载 作者:知者 更新时间:2024-03-13 11:22:25 25 4
gpt4 key购买 nike

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

ZKAssign.deleteNode介绍

[英]Deletes an existing unassigned node that is in the specified state for the specified entityGroup.

If a node does not already exist for this entityGroup, a org.apache.zookeeper.KeeperException.NoNodeException will be thrown.

No watcher is set whether this succeeds or not.

Returns false if the node was not in the proper state but did exist.

This method is used when a entityGroup finishes opening/closing. The Master acknowledges completion of the specified entityGroups transition to being closed/opened.
[中]删除处于指定entityGroup的指定状态的现有未分配节点。
如果此entityGroup的节点不存在,则为组织。阿帕奇。动物园管理员。保持异常。将抛出NoNodeException。
无论成功与否,都没有设置观察者。
如果节点未处于正确状态但确实存在,则返回false。
当entityGroup完成打开/关闭时,使用此方法。主机确认完成了指定的entityGroups转换,以关闭/打开。

代码示例

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

/**
 * Deletes an existing unassigned node that is in the OFFLINE state for the
 * specified entityGroup.
 *
 * <p>
 * If a node does not already exist for this entityGroup, a
 * {@link org.apache.zookeeper.KeeperException.NoNodeException} will be thrown.
 *
 * <p>
 * No watcher is set whether this succeeds or not.
 *
 * <p>
 * Returns false if the node was not in the proper state but did exist.
 *
 * <p>
 * This method is used during master failover when the entityGroups on an RS
 * that has died are all set to OFFLINE before being processed.
 *
 * @param zkw zk reference
 * @param entityGroupName closed entityGroup to be deleted from zk
 * @throws org.apache.zookeeper.KeeperException if unexpected zookeeper exception
 * @throws org.apache.zookeeper.KeeperException.NoNodeException if node does not exist
 */
public static boolean deleteOfflineNode(ZooKeeperWatcher zkw,
  String entityGroupName) throws KeeperException,
  KeeperException.NoNodeException {
 return deleteNode(zkw, entityGroupName, EventType.M_ZK_ENTITYGROUP_OFFLINE);
}

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

/**
 * Deletes an existing unassigned node that is in the CLOSED state for the
 * specified entityGroup.
 *
 * <p>
 * If a node does not already exist for this entityGroup, a
 * {@link org.apache.zookeeper.KeeperException.NoNodeException} will be thrown.
 *
 * <p>
 * No watcher is set whether this succeeds or not.
 *
 * <p>
 * Returns false if the node was not in the proper state but did exist.
 *
 * <p>
 * This method is used during table disables when a entityGroup finishes
 * successfully closing. This is the Master acknowledging completion of the
 * specified entityGroups transition to being closed.
 *
 * @param zkw zk reference
 * @param entityGroupName closed entityGroup to be deleted from zk
 * @throws org.apache.zookeeper.KeeperException if unexpected zookeeper exception
 * @throws org.apache.zookeeper.KeeperException.NoNodeException if node does not exist
 */
public static boolean deleteClosedNode(ZooKeeperWatcher zkw,
  String entityGroupName)
  throws KeeperException, KeeperException.NoNodeException {
 return deleteNode(zkw, entityGroupName, EventType.FSERVER_ZK_ENTITYGROUP_CLOSED);
}

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

/**
 * Deletes an existing unassigned node that is in the OPENED state for the
 * specified entityGroup.
 *
 * <p>
 * If a node does not already exist for this entityGroup, a
 * {@link org.apache.zookeeper.KeeperException.NoNodeException} will be thrown.
 *
 * <p>
 * No watcher is set whether this succeeds or not.
 *
 * <p>
 * Returns false if the node was not in the proper state but did exist.
 *
 * <p>
 * This method is used during normal entityGroup transitions when a
 * entityGroup finishes successfully opening. This is the Master acknowledging
 * completion of the specified entityGroups transition.
 *
 * @param zkw zk reference
 * @param entityGroupName opened entityGroup to be deleted from zk
 * @throws org.apache.zookeeper.KeeperException if unexpected zookeeper exception
 * @throws org.apache.zookeeper.KeeperException.NoNodeException if node does not exist
 */
public static boolean deleteOpenedNode(ZooKeeperWatcher zkw,
  String entityGroupName)
  throws KeeperException, KeeperException.NoNodeException {
 return deleteNode(zkw, entityGroupName, EventType.FSERVER_ZK_ENTITYGROUP_OPENED);
}

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

EventType expectedState) throws KeeperException,
 KeeperException.NoNodeException {
return deleteNode(zkw, entityGroupName, expectedState, -1);

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

/**
 * Deletes an existing unassigned node that is in the CLOSING state for the
 * specified entityGroup.
 *
 * <p>
 * If a node does not already exist for this entityGroup, a
 * {@link org.apache.zookeeper.KeeperException.NoNodeException} will be thrown.
 *
 * <p>
 * No watcher is set whether this succeeds or not.
 *
 * <p>
 * Returns false if the node was not in the proper state but did exist.
 *
 * <p>
 * This method is used during table disables when a entityGroup finishes
 * successfully closing. This is the Master acknowledging completion of the
 * specified entityGroups transition to being closed.
 *
 * @param zkw zk reference
 * @param entityGroup closing entityGroup to be deleted from zk
 * @throws org.apache.zookeeper.KeeperException if unexpected zookeeper exception
 * @throws org.apache.zookeeper.KeeperException.NoNodeException if node does not exist
 */
public static boolean deleteClosingNode(ZooKeeperWatcher zkw,
  EntityGroupInfo entityGroup) throws KeeperException,
  KeeperException.NoNodeException {
 String entityGroupName = entityGroup.getEncodedName();
 return deleteNode(zkw, entityGroupName, EventType.M_ZK_ENTITYGROUP_CLOSING);
}

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

/**
 *
 * @param entityGroup
 *          entityGroupinfo of znode to be deleted.
 */
public void deleteClosingOrClosedNode(EntityGroupInfo entityGroup) {
 try {
  if (!ZKAssign.deleteNode(watcher, entityGroup.getEncodedName(),
    EventHandler.EventType.M_ZK_ENTITYGROUP_CLOSING)) {
   boolean deleteNode = ZKAssign.deleteNode(watcher,
     entityGroup.getEncodedName(),
     EventHandler.EventType.FSERVER_ZK_ENTITYGROUP_CLOSED);
   // TODO : We don't abort if the delete node returns false. Is there any
   // such corner case?
   if (!deleteNode) {
    LOG.error("The deletion of the CLOSED node for the entityGroup "
      + entityGroup.getEncodedName() + " returned " + deleteNode);
   }
  }
 } catch (NoNodeException e) {
  LOG.debug("CLOSING/CLOSED node for the entityGroup "
    + entityGroup.getEncodedName() + " already deleted");
 } catch (KeeperException ke) {
  server.abort(
    "Unexpected ZK exception deleting node CLOSING/CLOSED for the entityGroup "
      + entityGroup.getEncodedName(), ke);
  return;
 }
}

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

successful = ZKAssign.deleteNode(this.server.getZooKeeper(),
  encodedEntityGroupName, EventType.FSERVER_ZK_ENTITYGROUP_SPLIT);

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

private static void cleanZK(final Server server, final EntityGroupInfo egi,
  boolean abort) {
 try {
  // Only delete if its in expected state; could have been hijacked.
  ZKAssign.deleteNode(server.getZooKeeper(), egi.getEncodedName(),
    EventHandler.EventType.FSERVER_ZK_ENTITYGROUP_SPLITTING);
 } catch (KeeperException.NoNodeException nn) {
  if (abort) {
   server.abort("Failed cleanup of " + egi.getEntityGroupNameAsString(),
     nn);
  }
 } catch (KeeperException e) {
  server.abort("Failed cleanup of " + egi.getEntityGroupNameAsString(), e);
 }
}

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

private boolean deleteOpenedNode(int expectedVersion) {
 debugLog(entityGroupInfo, "Handling OPENED event for "
   + this.entityGroupInfo.getEntityGroupNameAsString()
     + " from " + this.sn.toString() + "; deleting unassigned node");
 try {
  // delete the opened znode only if the version matches.
  return ZKAssign.deleteNode(server.getZooKeeper(),
    entityGroupInfo.getEncodedName(),
    EventType.FSERVER_ZK_ENTITYGROUP_OPENED,
    expectedVersion);
 } catch (KeeperException.NoNodeException e) {
  // Getting no node exception here means that already the entityGroup has been
  // opened.
  LOG.warn("The znode of the entityGroup "
    + entityGroupInfo.getEntityGroupNameAsString()
    + " would have already been deleted");
  return false;
 } catch (KeeperException e) {
  server.abort(
    "Error deleting OPENED node in ZK ("
      + entityGroupInfo.getEntityGroupNameAsString() + ")", e);
 }
 return false;
}

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

private void openEntityGroup(Server server, FServerServices rss, FTable ftd,
   EntityGroupInfo egi) throws IOException, NodeExistsException,
   KeeperException, DeserializationException {
  // Create it OFFLINE node, which is what Master set before sending OPEN RPC
  ZKAssign.createNodeOffline(server.getZooKeeper(), egi,
    server.getServerName());
  OpenEntityGroupHandler openHandler = new OpenEntityGroupHandler(server,
    rss, egi, ftd);
  openHandler.process();
  // This parse is not used?
  EntityGroupTransaction.parseFrom(ZKAssign.getData(server.getZooKeeper(),
    egi.getEncodedName()));
  // delete the node, which is what Master do after the entityGroup is opened
  ZKAssign.deleteNode(server.getZooKeeper(), egi.getEncodedName(),
    EventType.FSERVER_ZK_ENTITYGROUP_OPENED);
 }
}

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