Github user hanm commented on a diff in the pull request: https://github.com/apache/zookeeper/pull/106#discussion_r115353405 --- Diff: src/java/main/org/apache/zookeeper/server/quorum/QuorumPeer.java --- @@ -930,39 +918,36 @@ protected Election createElectionAlgorithm(int electionAlgorithm){ //TODO: use a factory rather than a switch switch (electionAlgorithm) { - case 0: - le = new LeaderElection(this); - break; - case 1: - le = new AuthFastLeaderElection(this); - break; - case 2: - le = new AuthFastLeaderElection(this, true); - break; - case 3: - qcm = new QuorumCnxManager(this); - 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; + case 0: + assert false : "Leader election algorithm type 0 is not supported anymore."; --- End diff -- I like the idea of catching invalid electionAlg value when parsing config file. Code updated by throwing an exception when input value is bad.
--- 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. ---