@Singleton public class StaticLeaderElectionService extends com.google.common.util.concurrent.AbstractIdleService implements LeaderElectionService
Configuration.isLeader() setting in the configuration file. After node
startup, the leader status is static and will not change.
If the value of Configuration.isLeader() is false, the node will not be a leader, if the value is true, the
node will be a leader, unless the node notices upon startup that there is another leader present in the cluster
already. In that case the value will be set to false and the node will act as a follower.
| Constructor and Description |
|---|
StaticLeaderElectionService(Configuration configuration) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
isLeader()
Check if the current node is the leader of the cluster.
|
protected void |
shutDown() |
protected void |
startUp() |
@Inject public StaticLeaderElectionService(Configuration configuration)
public boolean isLeader()
LeaderElectionServiceThis method might be called frequently. Implementations should be performant and resource-friendly.
isLeader in interface LeaderElectionServiceprotected void startUp()
throws Exception
startUp in class com.google.common.util.concurrent.AbstractIdleServiceExceptionCopyright © 2012–2022 Graylog, Inc.. All rights reserved.