Package com.atlassian.bamboo.beehive
Class BambooClusterNodeHeartBeatRawJdbcDao
java.lang.Object
com.atlassian.bamboo.beehive.AbstractBambooRawJdbcDao
com.atlassian.bamboo.beehive.BambooClusterNodeHeartBeatRawJdbcDao
- All Implemented Interfaces:
ClusterNodeHeartbeatDao
public class BambooClusterNodeHeartBeatRawJdbcDao
extends AbstractBambooRawJdbcDao
implements ClusterNodeHeartbeatDao
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
static final int
static final int
static final String
Fields inherited from class com.atlassian.bamboo.beehive.AbstractBambooRawJdbcDao
dbmsBean, hibernateConfig
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
deleteNode
(@NotNull String nodeId) Remove node by the given id.void
Creates heartbeat table if required.findAll()
Get all heartbeats.@NotNull List<BambooNodeInfo>
Get all present in the database nodes together with their heartbeats.@NotNull List<BambooNodeInfo>
findNodesInfoWithHeartbeatsAfter
(long time) Get all nodes in the database together with their heartbeats in the time window specified by the time argument.@NotNull Collection<String>
findNodesWithHeartbeatsAfter
(long time) @Nullable Long
getLastHeartbeatTime
(@NotNull String nodeId) Returns the last time a heartbeat was sent by the given node.@NotNull String
Returns the globally unique Identifier for this cluster node.void
writeHeartBeat
(long time) Writes a heartbeat for this node at the given time.Methods inherited from class com.atlassian.bamboo.beehive.AbstractBambooRawJdbcDao
ensureClusterTableExists, supplierWithConnection, withDatabaseConnection
-
Field Details
-
NODE_ID_MAX_LENGTH
public static final int NODE_ID_MAX_LENGTH- See Also:
-
NODE_NAME_MAX_LENGTH
public static final int NODE_NAME_MAX_LENGTH- See Also:
-
NODE_HOSTNAME_MAX_LENGTH
public static final int NODE_HOSTNAME_MAX_LENGTH- See Also:
-
TABLE_NAME
- See Also:
-
-
Constructor Details
-
BambooClusterNodeHeartBeatRawJdbcDao
public BambooClusterNodeHeartBeatRawJdbcDao()
-
-
Method Details
-
getNodeId
Description copied from interface:ClusterNodeHeartbeatDao
Returns the globally unique Identifier for this cluster node.- Specified by:
getNodeId
in interfaceClusterNodeHeartbeatDao
- Returns:
- the globally unique Identifier for this cluster node.
-
writeHeartBeat
public void writeHeartBeat(long time) Description copied from interface:ClusterNodeHeartbeatDao
Writes a heartbeat for this node at the given time. Caller will pass the time to stamp; in production this would normally beSystem.currentTimeMillis()
.- Specified by:
writeHeartBeat
in interfaceClusterNodeHeartbeatDao
- Parameters:
time
- the time in millis to write as the heartbeat.
-
getLastHeartbeatTime
Description copied from interface:ClusterNodeHeartbeatDao
Returns the last time a heartbeat was sent by the given node.A
null
value indicates no heartbeats have been sent by this node.- Specified by:
getLastHeartbeatTime
in interfaceClusterNodeHeartbeatDao
- Parameters:
nodeId
- the node- Returns:
- the last time a heartbeat was sent by the given node.
-
findNodesWithHeartbeatsAfter
- Specified by:
findNodesWithHeartbeatsAfter
in interfaceClusterNodeHeartbeatDao
-
findNodesInfoWithHeartbeatsAfter
Description copied from interface:ClusterNodeHeartbeatDao
Get all nodes in the database together with their heartbeats in the time window specified by the time argument.- Specified by:
findNodesInfoWithHeartbeatsAfter
in interfaceClusterNodeHeartbeatDao
- Parameters:
time
- the time in millis specifying the time window for the query- Returns:
- list of nodes
-
findAll
Description copied from interface:ClusterNodeHeartbeatDao
Get all heartbeats. The information about nodes' primary and alive attributes is not accurate.- Specified by:
findAll
in interfaceClusterNodeHeartbeatDao
-
findAllNodesInfo
Description copied from interface:ClusterNodeHeartbeatDao
Get all present in the database nodes together with their heartbeats.- Specified by:
findAllNodesInfo
in interfaceClusterNodeHeartbeatDao
- Returns:
- list of nodes
-
deleteNode
Description copied from interface:ClusterNodeHeartbeatDao
Remove node by the given id.- Specified by:
deleteNode
in interfaceClusterNodeHeartbeatDao
-
ensureNodeHeartbeatTableExists
public void ensureNodeHeartbeatTableExists()Description copied from interface:ClusterNodeHeartbeatDao
Creates heartbeat table if required.- Specified by:
ensureNodeHeartbeatTableExists
in interfaceClusterNodeHeartbeatDao
-