Class LeaderElectionActuator
java.lang.Object
com.netflix.genie.web.spring.actuators.LeaderElectionActuator
An actuator endpoint that exposes leadership status and allows stop/start/restart of the leader election service.
Useful when a specific set of nodes should be given priority to win the leader election (e.g., because they are
running newer code).
- Since:
- 4.0.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumOperations that this actuator can perform on the leader service. -
Constructor Summary
ConstructorsConstructorDescriptionLeaderElectionActuator(ClusterLeaderService clusterLeaderService) Constructor. -
Method Summary
-
Constructor Details
-
LeaderElectionActuator
Constructor.- Parameters:
clusterLeaderService- the cluster leader service
-
-
Method Details
-
getStatus
Provides the current leader service status: whether the leader service is running and whether the node is leader.- Returns:
- a map of attributes
-
doAction
@WriteOperation public void doAction()Forces the node to perform leader election related actions. This method uses direct request access to retrieve parameters, avoiding issues with parameter name resolution when compiled without the '-parameters' flag.Required request parameter: - action: The action to perform. Must be one of: START, STOP, RESTART
Example usage: POST /actuator/leaderElection?action=RESTART
- Throws:
IllegalStateException- if no request context is availableIllegalArgumentException- if the action parameter is missing or invalidUnsupportedOperationException- if the action is not supportedRuntimeException- if there is an error executing the requested action
-