Interface LeaderSelectorListener
- All Superinterfaces:
ConnectionStateListener
- All Known Implementing Classes:
ExampleClient
,LeaderSelectorListenerAdapter
Notification for leadership
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoid
takeLeadership
(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
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)
throwsCancelLeadershipException
. 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
-