zookeeper-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anmolnar <...@git.apache.org>
Subject [GitHub] zookeeper pull request #546: ZOOKEEPER-3066 Expose on JMX of Followers the i...
Date Fri, 22 Jun 2018 15:36:54 GMT
Github user anmolnar commented on a diff in the pull request:

    https://github.com/apache/zookeeper/pull/546#discussion_r197484891
  
    --- Diff: src/java/main/org/apache/zookeeper/server/quorum/QuorumPeer.java ---
    @@ -2069,4 +2073,9 @@ public QuorumCnxManager createCnxnManager() {
                     this.quorumCnxnThreadsSize,
                     this.isQuorumSaslAuthEnabled());
         }
    +
    +    boolean isLeader(long id) {
    +        Vote vote = getCurrentVote();
    +        return vote != null && id == vote.getId();
    --- End diff --
    
    You could use `state` property to check if the peer is the leader:
    ```java
    return state == ServerState.LEADING;
    ```
    What do you think?


---

Mime
View raw message