@Singleton public class AutomaticLeaderElectionService extends com.google.common.util.concurrent.AbstractExecutionThreadService implements LeaderElectionService
| Modifier and Type | Field and Description |
|---|---|
static Duration |
DEFAULT_POLLING_INTERVAL |
| Constructor and Description |
|---|
AutomaticLeaderElectionService(Configuration configuration,
LockService lockService,
com.google.common.eventbus.EventBus eventBus,
NodePingThread nodePingThread) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
isLeader()
Check if the current node is the leader of the cluster.
|
protected void |
run() |
protected void |
shutDown() |
protected void |
startUp() |
protected void |
triggerShutdown() |
public static final Duration DEFAULT_POLLING_INTERVAL
@Inject public AutomaticLeaderElectionService(Configuration configuration, LockService lockService, com.google.common.eventbus.EventBus eventBus, NodePingThread nodePingThread)
protected void startUp()
throws Exception
startUp in class com.google.common.util.concurrent.AbstractExecutionThreadServiceExceptionprotected void triggerShutdown()
triggerShutdown in class com.google.common.util.concurrent.AbstractExecutionThreadServiceprotected void shutDown()
shutDown in class com.google.common.util.concurrent.AbstractExecutionThreadServicepublic boolean isLeader()
LeaderElectionServiceThis method might be called frequently. Implementations should be performant and resource-friendly.
isLeader in interface LeaderElectionServiceCopyright © 2012–2022 Graylog, Inc.. All rights reserved.