public class StartableClusterNodeHeartbeatService extends Object implements ClusterNodeHeartbeatService, Startable
| Constructor and Description |
|---|
StartableClusterNodeHeartbeatService(ClusterNodeHeartBeatDao clusterNodeHeartBeatDao,
HeartbeatScheduledExecutorFactory scheduledExecutorFactory,
HeartbeatJob heartbeatJob,
com.atlassian.core.util.Clock clock,
HeartbeatSettings settings) |
| Modifier and Type | Method and Description |
|---|---|
Collection<String> |
findLiveNodes()
Returns all nodes that have sent a heartbeat within the default threshold time.
|
Collection<String> |
findLiveNodes(long threshold)
Returns all nodes that have sent a heartbeat within the given threshold.
|
Long |
getLastHeartbeatTime(String nodeId)
Returns the last time a heartbeat was sent by the given node.
|
String |
getNodeId()
Returns the node ID for this node.
|
boolean |
isNodeLive(String nodeId)
Checks whether the given cluster node is considered "live".
|
void |
start()
This method will be called after the plugin system is fully initialised and all components added to the
dependency injection framework.
|
public StartableClusterNodeHeartbeatService(ClusterNodeHeartBeatDao clusterNodeHeartBeatDao, HeartbeatScheduledExecutorFactory scheduledExecutorFactory, HeartbeatJob heartbeatJob, com.atlassian.core.util.Clock clock, HeartbeatSettings settings)
public void start()
throws Exception
Startable@Nonnull public String getNodeId()
ClusterNodeHeartbeatServicegetNodeId in interface ClusterNodeHeartbeatServicepublic boolean isNodeLive(@Nonnull String nodeId)
ClusterNodeHeartbeatServiceEach 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 ClusterNodeHeartbeatServicenodeId - the cluster node to check@Nullable public Long getLastHeartbeatTime(@Nonnull String nodeId)
ClusterNodeHeartbeatServiceA null value indicates no heartbeats have ever been sent by the given node.
getLastHeartbeatTime in interface ClusterNodeHeartbeatServicenodeId - the node@Nonnull public Collection<String> findLiveNodes()
ClusterNodeHeartbeatServicefindLiveNodes in interface ClusterNodeHeartbeatServiceClusterNodeHeartbeatService.findLiveNodes(long)@Nonnull public Collection<String> findLiveNodes(long threshold)
ClusterNodeHeartbeatServicefindLiveNodes in interface ClusterNodeHeartbeatServicethreshold - the threshold in millisecondsClusterNodeHeartbeatService.findLiveNodes()Copyright © 2002-2019 Atlassian. All Rights Reserved.