zookeeper-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hanm <...@git.apache.org>
Subject [GitHub] zookeeper pull request #106: ZOOKEEPER-1932: Remove deprecated LeaderElectio...
Date Mon, 08 May 2017 21:07:10 GMT
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message