Uploaded image for project: 'Apache Curator'
  1. Apache Curator
  2. CURATOR-51

LeaderSelector with custom Executor does not guarantee unique leadership

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.2.0-incubating
    • Fix Version/s: 2.3.0
    • Component/s: Recipes
    • Labels:
      None

      Description

      When providing a custom executor to the leader selector it creates a thread that waits for leadership.
      When it has leadership, it submits a runnable to the custom executor and then release leadership.

      If the executor is is e.g. a ThreadPoolExecutor, the takeLeadership method is executed asynchrounously, after releasing leadership.

      Is this a bug or am I missing the point of using my own executor?

      I have attached an example which shows multiple leaders being elected at the same time.
      (The example uses curator 1.3.3, but I think it is the same in 2.x)

        Attachments

        1. ZookeeperTest.log
          12 kB
          Henrik Nordvik
        2. ZookeeperTest.java
          3 kB
          Henrik Nordvik

          Activity

            People

            • Assignee:
              randgalt Jordan Zimmerman
              Reporter:
              zerd Henrik Nordvik
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: