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
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final intstatic final intstatic final StringFields inherited from class com.atlassian.bamboo.beehive.AbstractBambooRawJdbcDao
dbmsBean, hibernateConfig -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddeleteNode(@NotNull String nodeId) Remove node by the given id.voidCreates 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 LonggetLastHeartbeatTime(@NotNull String nodeId) Returns the last time a heartbeat was sent by the given node.@NotNull StringReturns the globally unique Identifier for this cluster node.@NotNull StringvoidwriteHeartBeat(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:
-
NODE_BUILD_NUMBER_MAX_LENGTH
public static final int NODE_BUILD_NUMBER_MAX_LENGTH- See Also:
-
TABLE_NAME
- See Also:
-
-
Constructor Details
-
BambooClusterNodeHeartBeatRawJdbcDao
public BambooClusterNodeHeartBeatRawJdbcDao()
-
-
Method Details
-
getNodeId
Description copied from interface:ClusterNodeHeartbeatDaoReturns the globally unique Identifier for this cluster node.- Specified by:
getNodeIdin interfaceClusterNodeHeartbeatDao- Returns:
- the globally unique Identifier for this cluster node.
-
getNodeName
- Specified by:
getNodeNamein interfaceClusterNodeHeartbeatDao- Returns:
- the name for this cluster node.
-
writeHeartBeat
public void writeHeartBeat(long time) Description copied from interface:ClusterNodeHeartbeatDaoWrites 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:
writeHeartBeatin interfaceClusterNodeHeartbeatDao- Parameters:
time- the time in millis to write as the heartbeat.
-
getLastHeartbeatTime
Description copied from interface:ClusterNodeHeartbeatDaoReturns the last time a heartbeat was sent by the given node.A
nullvalue indicates no heartbeats have been sent by this node.- Specified by:
getLastHeartbeatTimein interfaceClusterNodeHeartbeatDao- Parameters:
nodeId- the node- Returns:
- the last time a heartbeat was sent by the given node.
-
findNodesWithHeartbeatsAfter
- Specified by:
findNodesWithHeartbeatsAfterin interfaceClusterNodeHeartbeatDao
-
findNodesInfoWithHeartbeatsAfter
Description copied from interface:ClusterNodeHeartbeatDaoGet all nodes in the database together with their heartbeats in the time window specified by the time argument.- Specified by:
findNodesInfoWithHeartbeatsAfterin interfaceClusterNodeHeartbeatDao- Parameters:
time- the time in millis specifying the time window for the query- Returns:
- list of nodes
-
findAll
Description copied from interface:ClusterNodeHeartbeatDaoGet all heartbeats. The information about nodes' primary and alive attributes is not accurate.- Specified by:
findAllin interfaceClusterNodeHeartbeatDao
-
findAllNodesInfo
Description copied from interface:ClusterNodeHeartbeatDaoGet all present in the database nodes together with their heartbeats.- Specified by:
findAllNodesInfoin interfaceClusterNodeHeartbeatDao- Returns:
- list of nodes
-
deleteNode
Description copied from interface:ClusterNodeHeartbeatDaoRemove node by the given id.- Specified by:
deleteNodein interfaceClusterNodeHeartbeatDao
-
ensureNodeHeartbeatTableExists
public void ensureNodeHeartbeatTableExists()Description copied from interface:ClusterNodeHeartbeatDaoCreates heartbeat table if required.- Specified by:
ensureNodeHeartbeatTableExistsin interfaceClusterNodeHeartbeatDao
-