Interface LeaderLatchListener


public interface LeaderLatchListener
A LeaderLatchListener can be used to be notified asynchronously about when the state of the LeaderLatch has changed. Note that just because you are in the middle of one of these method calls, it does not necessarily mean that hasLeadership() is the corresponding true/false value. It is possible for the state to change behind the scenes before these methods get called. The contract is that if that happens, you should see another call to the other method pretty quickly.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    This is called when the LeaderLatch's state goes from hasLeadership = false to hasLeadership = true.
    void
    This is called when the LeaderLatch's state goes from hasLeadership = true to hasLeadership = false.
  • Method Details

    • isLeader

      void isLeader()
      This is called when the LeaderLatch's state goes from hasLeadership = false to hasLeadership = true. Note that it is possible that by the time this method call happens, hasLeadership has fallen back to false. If this occurs, you can expect notLeader() to also be called.
    • notLeader

      void notLeader()
      This is called when the LeaderLatch's state goes from hasLeadership = true to hasLeadership = false. Note that it is possible that by the time this method call happens, hasLeadership has become true. If this occurs, you can expect isLeader() to also be called.