本文整理了Java中com.alibaba.wasp.zookeeper.ZKUtil.deleteNode()
方法的一些代码示例,展示了ZKUtil.deleteNode()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZKUtil.deleteNode()
方法的具体详情如下:
包路径:com.alibaba.wasp.zookeeper.ZKUtil
类名称: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) {
内容来源于网络,如有侵权,请联系作者删除!