本文整理汇总了Java中org.apache.zookeeper.server.quorum.QuorumStats类的典型用法代码示例。如果您正苦于以下问题:Java QuorumStats类的具体用法?Java QuorumStats怎么用?Java QuorumStats使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
QuorumStats类属于org.apache.zookeeper.server.quorum包,在下文中一共展示了QuorumStats类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: testLEWithObserver
import org.apache.zookeeper.server.quorum.QuorumStats; //导入依赖的package包/类
/**
* See ZOOKEEPER-1294. Confirms that an observer will not support the quorum
* of a leader by forming a 5-node, 2-observer ensemble (so quorum size is 2).
* When all but the leader and one observer are shut down, the leader should
* enter the 'looking' state, not stay in the 'leading' state.
*/
@Test
public void testLEWithObserver() throws Exception {
QuorumPeer leader = null;
for (QuorumPeer server : Arrays.asList(qb.s1, qb.s2, qb.s3)) {
if (server.getServerState().equals(
QuorumStats.Provider.FOLLOWING_STATE)) {
server.shutdown();
assertTrue("Waiting for server down", ClientBase
.waitForServerDown("127.0.0.1:"
+ server.getClientPort(),
ClientBase.CONNECTION_TIMEOUT));
} else {
assertNull("More than one leader found", leader);
leader = server;
}
}
assertTrue("Leader is not in Looking state", ClientBase
.waitForServerState(leader, ClientBase.CONNECTION_TIMEOUT,
QuorumStats.Provider.LOOKING_STATE));
}
开发者ID:maoling,项目名称:fuck_zookeeper,代码行数:27,代码来源:ObserverLETest.java
注:本文中的org.apache.zookeeper.server.quorum.QuorumStats类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论