Interface LeaderSelectorListener

All Superinterfaces:
org.apache.curator.framework.state.ConnectionStateListener
All Known Implementing Classes:
LeaderSelectorListenerAdapter

public interface LeaderSelectorListener extends org.apache.curator.framework.state.ConnectionStateListener
Notification for leadership
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    takeLeadership(org.apache.curator.framework.CuratorFramework client)
    Called when your instance has been granted leadership.

    Methods inherited from interface org.apache.curator.framework.state.ConnectionStateListener

    doNotProxy, stateChanged
  • Method Details

    • takeLeadership

      void takeLeadership(org.apache.curator.framework.CuratorFramework client) throws Exception
      Called when your instance has been granted leadership. This method should not return until you wish to release leadership.

      It is guaranteed that there is no concurrent executions of this method.

      It is guaranteed that this method will be interrupted if ConnectionStateListener.stateChanged(CuratorFramework, ConnectionState) throws CancelLeadershipException. After interrupted, this method should exit(either return or throw) promptly, otherwise it will block following elections.

      Parameters:
      client - the client
      Throws:
      Exception - any errors