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?
---