Package org.graylog2.cluster.leader
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
-
Method Summary
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
Methods inherited from interface com.google.common.util.concurrent.Service
addListener, awaitRunning, awaitRunning, awaitRunning, awaitTerminated, awaitTerminated, awaitTerminated, failureCause, isRunning, startAsync, state, stopAsync
-
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 interfaceLeaderElectionService
- Returns:
- true if the current node is the leader, false if it is not
-
startUp
protected void startUp()- Specified by:
startUp
in classcom.google.common.util.concurrent.AbstractIdleService
-
shutDown
protected void shutDown()- Specified by:
shutDown
in classcom.google.common.util.concurrent.AbstractIdleService
-