本文整理汇总了Java中org.apache.zookeeper.server.quorum.QuorumPeer.ServerState.LOOKING属性的典型用法代码示例。如果您正苦于以下问题:Java ServerState.LOOKING属性的具体用法?Java ServerState.LOOKING怎么用?Java ServerState.LOOKING使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.apache.zookeeper.server.quorum.QuorumPeer.ServerState
的用法示例。
在下文中一共展示了ServerState.LOOKING属性的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: shutdownQP
private void shutdownQP(QuorumPeer qp) throws InterruptedException {
assertNotNull("QuorumPeer doesn't exist!", qp);
qp.shutdown();
int retryCnt = 30;
while (retryCnt > 0) {
if (qp.getPeerState() == ServerState.LOOKING) {
LOG.info("Number of retries:{} to change the server state to {}",
retryCnt, ServerState.LOOKING);
break;
}
Thread.sleep(500);
retryCnt--;
}
Assert.assertEquals(
"After shutdown, QuorumPeer should change its state to LOOKING",
ServerState.LOOKING, qp.getPeerState());
}
示例2: Vote
public Vote(long id,
long zxid) {
this.version = 0x0;
this.id = id;
this.zxid = zxid;
this.electionEpoch = -1;
this.peerEpoch = -1;
this.state = ServerState.LOOKING;
}
示例3: equals
@Override
public boolean equals(Object o) {
if (!(o instanceof Vote)) {
return false;
}
Vote other = (Vote) o;
/*
* There are two things going on in the logic below.
* First, we compare votes of servers out of election
* using only id and peer epoch. Second, if one version
* is 0x0 and the other isn't, then we only use the
* leader id. This case is here to enable rolling upgrades.
*
* {@see https://issues.apache.org/jira/browse/ZOOKEEPER-1805}
*/
if ((state == ServerState.LOOKING) ||
(other.state == ServerState.LOOKING)) {
return (id == other.id
&& zxid == other.zxid
&& electionEpoch == other.electionEpoch
&& peerEpoch == other.peerEpoch);
} else {
if ((version > 0x0) ^ (other.version > 0x0)) {
return id == other.id;
} else {
return (id == other.id
&& peerEpoch == other.peerEpoch);
}
}
}
示例4: Vote
public Vote(long id,
long zxid) {
this.version = 0x0;
this.id = id;
this.zxid = zxid;
this.electionEpoch = -1;
this.peerEpoch = -1;
this.state = ServerState.LOOKING;
}
示例5: Vote
public Vote(long id,
long zxid,
long peerEpoch) {
this.version = 0x0;
this.id = id;
this.zxid = zxid;
this.electionEpoch = -1;
this.peerEpoch = peerEpoch;
this.state = ServerState.LOOKING;
}
示例6: Vote
public Vote(long id, long zxid, long peerEpoch) {
this.id = id;
this.zxid = zxid;
this.electionEpoch = -1;
this.peerEpoch = peerEpoch;
this.state = ServerState.LOOKING;
}
示例7: Vote
public Vote(long id, long zxid) {
this.id = id;
this.zxid = zxid;
this.electionEpoch = -1;
this.peerEpoch = -1;
this.state = ServerState.LOOKING;
}