zookeeper-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eribeiro <...@git.apache.org>
Subject [GitHub] zookeeper pull request #476: ZOOKEEPER-2988: NPE triggered if server receive...
Date Tue, 17 Apr 2018 15:49:13 GMT
Github user eribeiro commented on a diff in the pull request:

    https://github.com/apache/zookeeper/pull/476#discussion_r182127687
  
    --- Diff: src/java/main/org/apache/zookeeper/server/quorum/FastLeaderElection.java ---
    @@ -927,10 +927,11 @@ public Vote lookForLeader() throws InterruptedException {
                                 tmpTimeOut : maxNotificationInterval);
                         LOG.info("Notification time out: " + notTimeout);
                     } 
    -                else if (self.getCurrentAndNextConfigVoters().contains(n.sid)) {
    +                else if (self.getCurrentAndNextConfigVoters().contains(n.sid) &&
    --- End diff --
    
    As this PR modifies this line and add similar ones, wouldn't be the case of creating a
private method with a meaningful name like below?
    ```
    private boolean configVotersContains(long sid) {
        return self.getCurrentAndNextConfigVoters().contains(sid);
    }
    ```
    
    This makes this line and the lines below more readable, imho.


---

Mime
View raw message