You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@zookeeper.apache.org by eribeiro <gi...@git.apache.org> on 2018/04/17 15:49:13 UTC
[GitHub] zookeeper pull request #476: ZOOKEEPER-2988: NPE triggered if server receive...
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.
---