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

Remove duplicate condition check in ZooKeeperLeaderElectionService

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Trivial
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.0.0, 1.1.0
    • Component/s: None
    • Labels:
      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

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

              Dates

              • Created:
                Updated:
                Resolved: