You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@zookeeper.apache.org by arshadmohammad <gi...@git.apache.org> on 2017/05/06 03:30:26 UTC

[GitHub] zookeeper pull request #106: ZOOKEEPER-1932: Remove deprecated LeaderElectio...

Github user arshadmohammad commented on a diff in the pull request:

    https://github.com/apache/zookeeper/pull/106#discussion_r115112178
  
    --- 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 --
    
    Another option is  validate electionAlg in org.apache.zookeeper.server.quorum.QuorumPeerConfig and exit from there for wrong input and remove the case from here 


---
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.
---