当前位置: 首页>>代码示例>>Java>>正文


Java ServerState.LOOKING属性代码示例

本文整理汇总了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());
}
 
开发者ID:l294265421,项目名称:ZooKeeper,代码行数:18,代码来源:QuorumDigestAuthTest.java

示例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;
}
 
开发者ID:maoling,项目名称:fuck_zookeeper,代码行数:9,代码来源:Vote.java

示例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);
        }
    } 
}
 
开发者ID:maoling,项目名称:fuck_zookeeper,代码行数:32,代码来源:Vote.java

示例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;
}
 
开发者ID:didichuxing2,项目名称:https-github.com-apache-zookeeper,代码行数:9,代码来源:Vote.java

示例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;
}
 
开发者ID:sereca,项目名称:SecureKeeper,代码行数:10,代码来源:Vote.java

示例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;
}
 
开发者ID:gerritjvv,项目名称:bigstreams,代码行数:7,代码来源:Vote.java

示例7: Vote

public Vote(long id, long zxid) {
    this.id = id;
    this.zxid = zxid;
    this.electionEpoch = -1;
    this.peerEpoch = -1;
    this.state = ServerState.LOOKING;
}
 
开发者ID:gerritjvv,项目名称:bigstreams,代码行数:7,代码来源:Vote.java


注:本文中的org.apache.zookeeper.server.quorum.QuorumPeer.ServerState.LOOKING属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。