Github user hanm commented on a diff in the pull request: https://github.com/apache/zookeeper/pull/92#discussion_r90916712 --- Diff: src/java/main/org/apache/zookeeper/server/quorum/QuorumPeer.java --- @@ -1390,24 +1406,29 @@ public QuorumVerifier configFromString(String s) throws IOException, ConfigExcep } /** - * Return QuorumVerifier object for the last committed configuration + * Return QuorumVerifier object for the last committed configuration. */ - - public synchronized QuorumVerifier getQuorumVerifier(){ - return quorumVerifier; - + public QuorumVerifier getQuorumVerifier(){ + synchronized (qvLock) { + return quorumVerifier; + } } - public synchronized QuorumVerifier getLastSeenQuorumVerifier(){ - return lastSeenQuorumVerifier; + /** + * Return QuorumVerifier object for the last proposed configuration. + */ + public QuorumVerifier getLastSeenQuorumVerifier(){ + synchronized (qvLock) { + return lastSeenQuorumVerifier; + } } - public synchronized void connectNewPeers(){ - if (qcm!=null && getQuorumVerifier()!=null && getLastSeenQuorumVerifier()!=null) { - Map<Long, QuorumServer> committedView = getQuorumVerifier().getAllMembers(); - for (Entry<Long, QuorumServer> e: getLastSeenQuorumVerifier().getAllMembers().entrySet()){ + private void connectNewPeers(){ --- End diff -- @lvfangmin Good suggestion, PR updated. Thanks for double checking.
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---