Interface LeaderElectionService

All Superinterfaces:
com.google.common.util.concurrent.Service
All Known Implementing Classes:
AutomaticLeaderElectionService, FakeLeaderElectionService, StaticLeaderElectionService

public interface LeaderElectionService extends com.google.common.util.concurrent.Service
  • Nested Class Summary

    Nested classes/interfaces inherited from interface com.google.common.util.concurrent.Service

    com.google.common.util.concurrent.Service.Listener, com.google.common.util.concurrent.Service.State
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Check if the current node is the leader of the cluster.

    Methods inherited from interface com.google.common.util.concurrent.Service

    addListener, awaitRunning, awaitRunning, awaitRunning, awaitTerminated, awaitTerminated, awaitTerminated, failureCause, isRunning, startAsync, state, stopAsync
  • Method Details

    • isLeader

      boolean isLeader()
      Check if the current node is the leader of the cluster.

      This method might be called frequently. Implementations should be performant and resource-friendly.

      Returns:
      true if the current node is the leader, false if it is not