本文整理了Java中com.alibaba.wasp.zookeeper.ZKAssign.createNodeClosing()
方法的一些代码示例,展示了ZKAssign.createNodeClosing()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZKAssign.createNodeClosing()
方法的具体详情如下:
包路径:com.alibaba.wasp.zookeeper.ZKAssign
类名称:ZKAssign
方法名:createNodeClosing
[英]Creates a new unassigned node in the CLOSING state for the specified entityGroup.
Does not transition nodes from any states. If a node already exists for this entityGroup, a org.apache.zookeeper.KeeperException.NodeExistsException will be thrown.
If creation is successful, returns the version number of the CLOSING node created.
Does not set any watches.
This method should only be used by a FServer when initiating a close of a entityGroup after receiving a CLOSE RPC from the Master.
[中]为指定的entityGroup创建处于关闭状态的新未分配节点。
不从任何状态转换节点。如果此entityGroup已存在节点,则为组织。阿帕奇。动物园管理员。保持异常。将抛出NodeExistsException。
如果创建成功,则返回创建的关闭节点的版本号。
不设置任何手表。
仅当FServer在从主服务器接收到关闭RPC后启动entityGroup关闭时,才应使用此方法。
代码示例来源:origin: alibaba/wasp
return;
versionOfClosingNode = ZKAssign.createNodeClosing(watcher,
entityGroup, state.getServerName());
if (versionOfClosingNode == -1) {
代码示例来源:origin: alibaba/wasp
ZKAssign.createNodeClosing(zkw, egi, new ServerName("any.old.server",
1234, -1));
代码示例来源:origin: alibaba/wasp
/**
* Test if close entityGroup can handle ZK closing node version mismatch
*
* @throws java.io.IOException
* @throws org.apache.zookeeper.KeeperException.NodeExistsException
* @throws org.apache.zookeeper.KeeperException
* @throws com.alibaba.wasp.DeserializationException
*/
@Test
public void testZKClosingNodeVersionMismatch() throws IOException,
NodeExistsException, KeeperException, DeserializationException {
final Server server = new MockServer(WTU);
final MockFServerServices rss = new MockFServerServices();
FTable ftd = TEST_FTD;
final EntityGroupInfo egi = TEST_EGI;
// open a entityGroup first so that it can be closed later
openEntityGroup(server, rss, ftd, egi);
int versionOfClosingNode = ZKAssign.createNodeClosing(
server.getZooKeeper(), egi, server.getServerName());
CloseEntityGroupHandler handler = new CloseEntityGroupHandler(server, rss,
egi, false, true, versionOfClosingNode + 1,
EventType.M_FSERVER_CLOSE_ENTITYGROUP);
handler.process();
EntityGroupTransaction rt = EntityGroupTransaction.parseFrom(ZKAssign
.getData(server.getZooKeeper(), egi.getEncodedName()));
assertTrue(rt.getEventType().equals(EventType.M_ZK_ENTITYGROUP_CLOSING));
}
代码示例来源:origin: alibaba/wasp
/**
* Test if the entityGroup can be closed properly
*
* @throws java.io.IOException
* @throws org.apache.zookeeper.KeeperException.NodeExistsException
* @throws org.apache.zookeeper.KeeperException
* @throws com.alibaba.wasp.DeserializationException
*/
@Test
public void testCloseEntityGroup() throws IOException, NodeExistsException,
KeeperException, DeserializationException {
final Server server = new MockServer(WTU);
final MockFServerServices rss = new MockFServerServices();
FTable htd = TEST_FTD;
EntityGroupInfo egi = TEST_EGI;
openEntityGroup(server, rss, htd, egi);
int versionOfClosingNode = ZKAssign.createNodeClosing(
server.getZooKeeper(), egi, server.getServerName());
CloseEntityGroupHandler handler = new CloseEntityGroupHandler(server, rss,
egi, false, true, versionOfClosingNode,
EventType.M_FSERVER_CLOSE_ENTITYGROUP);
handler.process();
EntityGroupTransaction rt = EntityGroupTransaction.parseFrom(ZKAssign
.getData(server.getZooKeeper(), egi.getEncodedName()));
assertTrue(rt.getEventType()
.equals(EventType.FSERVER_ZK_ENTITYGROUP_CLOSED));
}
内容来源于网络,如有侵权,请联系作者删除!