HorizonNet commented on a change in pull request #1171: ZOOKEEPER-2083 Remove
deprecated class AuthFastLeaderElection
URL: https://github.com/apache/zookeeper/pull/1171#discussion_r358354304
##########
File path:
zookeeper-server/src/main/java/org/apache/zookeeper/server/quorum/QuorumPeer.java
##########
@@ -1224,33 +1224,20 @@ protected Observer makeObserver(FileTxnSnapLog
logFactory) throws IOException {
protected Election createElectionAlgorithm(int electionAlgorithm) {
Election le = null;
- //TODO: use a factory rather than a switch
- switch (electionAlgorithm) {
- case 1:
- le = new AuthFastLeaderElection(this);
- break;
- case 2:
- le = new AuthFastLeaderElection(this, true);
- break;
- case 3:
- QuorumCnxManager qcm = createCnxnManager();
- QuorumCnxManager oldQcm = qcmRef.getAndSet(qcm);
- if (oldQcm != null) {
- LOG.warn("Clobbering already-set QuorumCnxManager (restarting
leader election?)");
- oldQcm.halt();
- }
- QuorumCnxManager.Listener listener = qcm.listener;
- if (listener != null) {
- listener.start();
- FastLeaderElection fle = new FastLeaderElection(this, qcm);
- fle.start();
- le = fle;
- } else {
- LOG.error("Null listener when initializing cnx manager");
- }
- break;
- default:
- assert false;
+ QuorumCnxManager qcm = createCnxnManager();
Review comment:
Does it make sense to make this variable (and the others) `final`?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services