本文整理了Java中com.alibaba.wasp.zookeeper.ZKAssign.getNodeName()
方法的一些代码示例,展示了ZKAssign.getNodeName()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZKAssign.getNodeName()
方法的具体详情如下:
包路径:com.alibaba.wasp.zookeeper.ZKAssign
类名称:ZKAssign
方法名:getNodeName
[英]Gets the full path node name for the unassigned node for the specified entityGroup.
[中]获取指定entityGroup的未分配节点的完整路径节点名。
代码示例来源:origin: alibaba/wasp
/**
* @param zkw
* @param pathOrEntityGroupName
* @return Path to znode
*/
public static String getPath(final ZooKeeperWatcher zkw,
final String pathOrEntityGroupName) {
return pathOrEntityGroupName.startsWith("/") ? pathOrEntityGroupName : getNodeName(
zkw, pathOrEntityGroupName);
}
代码示例来源:origin: alibaba/wasp
/**
* Get the version of the specified znode
* @param zkw zk reference
* @param entityGroup entityGroup's info
* @return the version of the znode, -1 if it doesn't exist
* @throws org.apache.zookeeper.KeeperException
*/
public static int getVersion(ZooKeeperWatcher zkw, EntityGroupInfo entityGroup)
throws KeeperException {
String znode = getNodeName(zkw, entityGroup.getEncodedName());
return ZKUtil.checkExists(zkw, znode);
}
代码示例来源:origin: alibaba/wasp
/**
* Delete the assignment node regardless of its current state.
* <p>
* Fail silent even if the node does not exist at all.
* @param watcher
* @param entityGroupInfo
* @throws org.apache.zookeeper.KeeperException
*/
public static void deleteNodeFailSilent(ZooKeeperWatcher watcher,
EntityGroupInfo entityGroupInfo) throws KeeperException {
String node = getNodeName(watcher, entityGroupInfo.getEncodedName());
ZKUtil.deleteNodeFailSilent(watcher, node);
}
代码示例来源:origin: alibaba/wasp
String node = ZKAssign.getNodeName(watcher,
entityGroupInfo.getEncodedName());
Stat stat = new Stat();
代码示例来源:origin: alibaba/wasp
public static void createNodeOffline(ZooKeeperWatcher zkw,
EntityGroupInfo entityGroup, ServerName serverName, final EventType event)
throws KeeperException, KeeperException.NodeExistsException {
LOG.debug(zkw.prefix("Creating unassigned node for "
+ entityGroup.getEncodedName() + " in OFFLINE state"));
EntityGroupTransaction rt = EntityGroupTransaction.createEntityGroupTransition(event,
entityGroup.getEntityGroupName(), serverName);
String node = getNodeName(zkw, entityGroup.getEncodedName());
ZKUtil.createAndWatch(zkw, node, rt.toByteArray());
}
代码示例来源:origin: alibaba/wasp
EventHandler.EventType.FSERVER_ZK_ENTITYGROUP_SPLITTING,
entityGroup.getEntityGroupName(), serverName);
String node = ZKAssign.getNodeName(zkw, entityGroup.getEncodedName());
if (!ZKUtil.createEphemeralNodeAndWatch(zkw, node, data.toByteArray())) {
throw new IOException("Failed create of ephemeral " + node);
代码示例来源:origin: alibaba/wasp
/**
* Creates an unassigned node in the OFFLINE state for the specified
* entityGroup.
* <p>
* Runs asynchronously. Depends on no pre-existing znode.
*
* <p>
* Sets a watcher on the unassigned entityGroup node.
*
* @param zkw zk reference
* @param entityGroup entityGroup to be created as offline
* @param serverName server transition will happen on
* @param cb
* @param ctx
* @throws org.apache.zookeeper.KeeperException if unexpected zookeeper exception
* @throws org.apache.zookeeper.KeeperException.NodeExistsException if node already exists
*/
public static void asyncCreateNodeOffline(ZooKeeperWatcher zkw,
EntityGroupInfo entityGroup, ServerName serverName,
final AsyncCallback.StringCallback cb, final Object ctx)
throws KeeperException {
LOG.debug(zkw.prefix("Async create of unassigned node for "
+ entityGroup.getEncodedName() + " with OFFLINE state"));
EntityGroupTransaction rt = EntityGroupTransaction.createEntityGroupTransition(
EventType.M_ZK_ENTITYGROUP_OFFLINE, entityGroup.getEntityGroupName(), serverName);
String node = getNodeName(zkw, entityGroup.getEncodedName());
ZKUtil.asyncCreate(zkw, node, rt.toByteArray(), cb, ctx);
}
代码示例来源:origin: alibaba/wasp
String node = ZKAssign.getNodeName(this.watcher,
entityGroupInfo.getEncodedName());
Stat stat = new Stat();
代码示例来源:origin: alibaba/wasp
LOG.debug(zkw.prefix("Deleting existing unassigned " + "node for "
+ entityGroupName + " that is in expected state " + expectedState));
String node = getNodeName(zkw, entityGroupName);
zkw.sync(node);
Stat stat = new Stat();
代码示例来源:origin: alibaba/wasp
EventType.M_ZK_ENTITYGROUP_CLOSING, entityGroup.getEntityGroupName(), serverName,
HConstants.EMPTY_BYTE_ARRAY);
String node = getNodeName(zkw, entityGroup.getEncodedName());
return ZKUtil.createAndWatch(zkw, node, rt.toByteArray());
代码示例来源:origin: alibaba/wasp
@Override
EntityGroup openEntityGroup() {
// Open entityGroup first, then remove znode as though it'd been
// hijacked.
EntityGroup entityGroup = super.openEntityGroup();
// Don't actually open entityGroup BUT remove the znode as though it'd
// been hijacked on us.
ZooKeeperWatcher zkw = this.server.getZooKeeper();
String node = ZKAssign.getNodeName(zkw, egi.getEncodedName());
try {
ZKUtil.deleteNodeFailSilent(zkw, node);
} catch (KeeperException e) {
throw new RuntimeException("Ugh failed delete of " + node, e);
}
return entityGroup;
}
};
代码示例来源:origin: alibaba/wasp
String node = getNodeName(zkw, encoded);
zkw.sync(node);
代码示例来源:origin: alibaba/wasp
HConstants.EMPTY_BYTE_ARRAY);
byte[] data = rt.toByteArray();
String node = getNodeName(zkw, entityGroup.getEncodedName());
zkw.sync(node);
int version = ZKUtil.checkExists(zkw, node);
代码示例来源:origin: alibaba/wasp
String encoded = region.getEncodedName();
String node = ZKAssign.getNodeName(zkw, encoded);
zkw.sync(node);
代码示例来源:origin: alibaba/wasp
when(am.getZKTable()).thenReturn(new ZKTable(zkw));
Stat stat = new Stat();
String nodeName = ZKAssign.getNodeName(zkw, entityGroup
.getEntityGroupInfo().getEncodedName());
ZKUtil.getDataAndWatch(zkw, nodeName, stat);
代码示例来源:origin: alibaba/wasp
st.execute(fserver, fserver);
} catch (IOException e) {
String node = ZKAssign.getNodeName(fserver.getZooKeeper(), entityGroups
.get(0).getEntityGroupInfo().getEncodedName());
if (nodeCreated) {
代码示例来源:origin: alibaba/wasp
String path = ZKAssign.getNodeName(zkw, egi.getEncodedName());
Stat stats = zkw.getRecoverableZooKeeper().exists(path, false);
LOG.info("EPHEMERAL NODE BEFORE SERVER ABORT, path=" + path + ", stats="
代码示例来源:origin: alibaba/wasp
assertTrue(daughters.size() >= 2);
String path = ZKAssign.getNodeName(zkw, egi.getEncodedName());
Stat stats = zkw.getRecoverableZooKeeper().exists(path, false);
LOG.info("EPHEMERAL NODE BEFORE SERVER ABORT, path=" + path + ", stats="
内容来源于网络,如有侵权,请联系作者删除!