public class BambooClusterNodeHeartbeatServiceImpl extends Object implements BambooClusterNodeHeartbeatService
Modifier and Type | Field and Description |
---|---|
static int |
MAX_TIME_WITHOUT_LOCK_MINUTES |
Constructor and Description |
---|
BambooClusterNodeHeartbeatServiceImpl(@NotNull ClusterNodeHeartbeatBootstrapDao clusterNodeHeartBeatDao,
@NotNull ClusterLockBootstrapDao clusterLockBootstrapDao,
@NotNull BambooLicenseManager bambooLicenseManager) |
Modifier and Type | Method and Description |
---|---|
@NotNull Collection<String> |
findLiveNodes()
Returns all nodes that have sent a heartbeat within the default threshold time.
|
@NotNull Collection<String> |
findLiveNodes(long threshold)
Returns all nodes that have sent a heartbeat within the given threshold.
|
Long |
getLastHeartbeatTime(@NotNull String nodeId)
Returns the last time a heartbeat was sent by the given node.
|
@NotNull String |
getNodeId()
Returns the node ID for this node.
|
@NotNull List<BambooNodeStatus> |
getNodeStatuses()
Get status of all nodes if DC license applied otherwise empty list.
|
boolean |
isCurrentNodePrimaryBuffered() |
boolean |
isNodeHeartbeatStarted() |
boolean |
isNodeLive(@NotNull String nodeId)
Checks whether the given cluster node is considered "live".
|
protected com.atlassian.scheduler.JobRunner |
newHeartbeatJobRunner() |
void |
setCurrentNodePrimary(boolean primary)
Set current node's primary flag.
|
void |
startNodeHeartbeat()
Starts registering heartbeats for the current node.
|
@Inject public BambooClusterNodeHeartbeatServiceImpl(@NotNull @NotNull ClusterNodeHeartbeatBootstrapDao clusterNodeHeartBeatDao, @NotNull @NotNull ClusterLockBootstrapDao clusterLockBootstrapDao, @NotNull @NotNull BambooLicenseManager bambooLicenseManager) throws com.atlassian.scheduler.SchedulerServiceException
com.atlassian.scheduler.SchedulerServiceException
public void startNodeHeartbeat() throws Exception
BambooClusterNodeHeartbeatService
startNodeHeartbeat
in interface BambooClusterNodeHeartbeatService
Exception
@NotNull public @NotNull String getNodeId()
BambooClusterNodeHeartbeatService
getNodeId
in interface BambooClusterNodeHeartbeatService
public boolean isNodeLive(@NotNull @NotNull String nodeId)
BambooClusterNodeHeartbeatService
Each live node will be writing a heartbeat on a set schedule (eg once a minute). A node is considered live if it has written a heartbeat within a reasonable tolerance level (eg 5 minutes).
The tolerance level needs to be large enough to avoid certain expected slow-downs in the system including GC pauses, or just general slowness in the JVM / scheduler / network / database of the remote node.
isNodeLive
in interface BambooClusterNodeHeartbeatService
nodeId
- the cluster node to checkpublic Long getLastHeartbeatTime(@NotNull @NotNull String nodeId)
BambooClusterNodeHeartbeatService
A null
value indicates no heartbeats have ever been sent by the given node.
getLastHeartbeatTime
in interface BambooClusterNodeHeartbeatService
nodeId
- the node@NotNull public @NotNull Collection<String> findLiveNodes()
BambooClusterNodeHeartbeatService
findLiveNodes
in interface BambooClusterNodeHeartbeatService
BambooClusterNodeHeartbeatService.findLiveNodes(long)
@NotNull public @NotNull Collection<String> findLiveNodes(long threshold)
BambooClusterNodeHeartbeatService
findLiveNodes
in interface BambooClusterNodeHeartbeatService
threshold
- the threshold in millisecondsBambooClusterNodeHeartbeatService.findLiveNodes()
public boolean isNodeHeartbeatStarted()
isNodeHeartbeatStarted
in interface BambooClusterNodeHeartbeatService
public void setCurrentNodePrimary(boolean primary)
BambooClusterNodeHeartbeatService
setCurrentNodePrimary
in interface BambooClusterNodeHeartbeatService
public boolean isCurrentNodePrimaryBuffered()
isCurrentNodePrimaryBuffered
in interface BambooClusterNodeHeartbeatService
@NotNull public @NotNull List<BambooNodeStatus> getNodeStatuses()
BambooClusterNodeHeartbeatService
getNodeStatuses
in interface BambooClusterNodeHeartbeatService
protected com.atlassian.scheduler.JobRunner newHeartbeatJobRunner()
Copyright © 2022 Atlassian Software Systems Pty Ltd. All rights reserved.