Class LeaderElectionActuator

java.lang.Object
com.netflix.genie.web.spring.actuators.LeaderElectionActuator

@Endpoint(id="leaderElection") public class LeaderElectionActuator extends Object
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
  • Constructor Details

    • LeaderElectionActuator

      public LeaderElectionActuator(ClusterLeaderService clusterLeaderService)
      Constructor.
      Parameters:
      clusterLeaderService - the cluster leader service
  • Method Details

    • getStatus

      @ReadOperation public Map<String,Object> 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 available
      IllegalArgumentException - if the action parameter is missing or invalid
      UnsupportedOperationException - if the action is not supported
      RuntimeException - if there is an error executing the requested action