gpt4 book ai didi

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

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

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

ZKUtil.deleteNode介绍

[英]Delete the specified node. Sets no watches. Throws all exceptions.
[中]删除指定的节点。没有手表。抛出所有异常。

代码示例

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

/**
 * Delete the specified node. Sets no watches. Throws all exceptions.
 */
public static void deleteNode(ZooKeeperWatcher zkw, String node)
  throws KeeperException {
 deleteNode(zkw, node, -1);
}

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

msg = ("Current master has this master's address, " + currentMaster + "; master was restarted? Deleting node.");
ZKUtil.deleteNode(this.watcher,
  this.watcher.getMasterAddressZNode());

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

/**
 * Sets the cluster as down by deleting the znode.
 *
 * @throws org.apache.zookeeper.KeeperException
 *           unexpected zk exception
 */
public void setClusterDown() throws KeeperException {
 try {
  ZKUtil.deleteNode(watcher, watcher.clusterStateZNode);
 } catch (KeeperException.NoNodeException nne) {
  LOG.warn("Attempted to set cluster as down but already down, cluster "
    + "state node (" + watcher.clusterStateZNode + ") not found");
 }
}

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

private void deleteMyEphemeralNode() throws KeeperException {
 ZKUtil.deleteNode(this.zooKeeper, getMyEphemeralNodePath());
}

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

public void stop() {
  try {
   // If our address is in ZK, delete it on our way out
   ServerName activeMaster = null;
   try {
    activeMaster = MasterAddressTracker.getMasterAddress(this.watcher);
   } catch (IOException e) {
    LOG.warn("Failed get of master address: " + e.toString());
   }
   if (activeMaster != null && activeMaster.equals(this.sn)) {
    ZKUtil.deleteNode(watcher, watcher.getMasterAddressZNode());
    // We may have failed to delete the znode at the previous step, but
    // we delete the file anyway: a second attempt to delete the znode is
    // likely to fail again.
    ZNodeClearer.deleteMyEphemeralNodeOnDisk();
   }
  } catch (KeeperException e) {
   LOG.error(
     this.watcher.prefix("Error deleting our own master address node"), e);
  }
 }
}

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

/**
  * delete the master znode if its content is same as the parameter
  */
 public static boolean deleteIfEquals(ZooKeeperWatcher zkw,
   final String content) {
  if (content == null) {
   throw new IllegalArgumentException("Content must not be null");
  }

  try {
   Stat stat = new Stat();
   byte[] data = ZKUtil.getDataNoWatch(zkw, zkw.getMasterAddressZNode(),
     stat);
   ServerName sn = ServerName.parseFrom(data);
   if (sn != null && content.equals(sn.toString())) {
    return (ZKUtil.deleteNode(zkw, zkw.getMasterAddressZNode(),
      stat.getVersion()));
   }
  } catch (KeeperException e) {
   LOG.warn("Can't get or delete the master znode", e);
  } catch (DeserializationException e) {
   LOG.warn("Can't get or delete the master znode", e);
  }

  return false;
 }
}

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

return false;
if (!ZKUtil.deleteNode(zkw, node, stat.getVersion())) {
 LOG.warn(zkw.prefix("Attempting to delete " + "unassigned node "
   + entityGroupName + " in " + expectedState

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

"testActiveMasterManagerFromZK", null, true);
try {
 ZKUtil.deleteNode(zk, zk.getMasterAddressZNode());
 ZKUtil.deleteNode(zk, zk.clusterStateZNode);
} catch (KeeperException.NoNodeException nne) {
ZKUtil.deleteNode(zk, zk.getMasterAddressZNode());
ZKUtil.deleteNode(zk, zk.getMasterAddressZNode());

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

"testActiveMasterManagerFromZK", null, true);
try {
 ZKUtil.deleteNode(zk, zk.getMasterAddressZNode());
 ZKUtil.deleteNode(zk, zk.clusterStateZNode);
} catch (KeeperException.NoNodeException nne) {

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