Class FakeLeaderElectionService

java.lang.Object
com.google.common.util.concurrent.AbstractIdleService
org.graylog2.cluster.leader.FakeLeaderElectionService
All Implemented Interfaces:
com.google.common.util.concurrent.Service, LeaderElectionService

@Singleton public class FakeLeaderElectionService extends com.google.common.util.concurrent.AbstractIdleService implements LeaderElectionService
Leader election when we don't care (i.e. Forwarder) - always claim leader
  • 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
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

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

    Methods inherited from class com.google.common.util.concurrent.AbstractIdleService

    addListener, awaitRunning, awaitRunning, awaitRunning, awaitTerminated, awaitTerminated, awaitTerminated, executor, failureCause, isRunning, serviceName, startAsync, state, stopAsync, toString

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • FakeLeaderElectionService

      public FakeLeaderElectionService()
  • Method Details

    • isLeader

      public boolean isLeader()
      Description copied from interface: LeaderElectionService
      Check if the current node is the leader of the cluster.

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

      Specified by:
      isLeader in interface LeaderElectionService
      Returns:
      true if the current node is the leader, false if it is not
    • startUp

      protected void startUp()
      Specified by:
      startUp in class com.google.common.util.concurrent.AbstractIdleService
    • shutDown

      protected void shutDown()
      Specified by:
      shutDown in class com.google.common.util.concurrent.AbstractIdleService