Github user eolivelli commented on a diff in the pull request:
https://github.com/apache/zookeeper/pull/707#discussion_r235713462
--- Diff:
zookeeper-server/src/main/java/org/apache/zookeeper/server/quorum/QuorumPeer.java
---
@@ -108,7 +109,11 @@
LocalPeerBean jmxLocalPeerBean;
private Map<Long, RemotePeerBean> jmxRemotePeerBean;
LeaderElectionBean jmxLeaderElectionBean;
- private QuorumCnxManager qcm;
+
+ // The QuorumCnxManager is held through an AtomicReference to ensure
cross-thread visibility
+ // of updates; see the implementation comment at
setLastSeenQuorumVerifier().
+ private AtomicReference<QuorumCnxManager> qcmRef = new
AtomicReference<>();
--- End diff --
If we are not using Compare and set, why a volatile is not enough?
---