Uploaded image for project: 'Flink'
  1. Flink
  2. FLINK-3461

Remove duplicate condition check in ZooKeeperLeaderElectionService

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • 1.0.0, 1.1.0
    • None
    • None

    Description

      In ZooKeeperLeaderElectionService:

      @Override
      public boolean hasLeadership() {
        if(leaderLatch.getState().equals(LeaderLatch.State.STARTED)) {
          return leaderLatch.hasLeadership();
        } else {
          return false;
        }
      }
      

      Looking into the leader leaderLatch.hasLeadership(), the state gets checked already/again.

      return (state.get() == State.STARTED) && hasLeadership.get();
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            uce Ufuk Celebi
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: