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
Fields Modifier and Type Field Description static int
NODE_HOSTNAME_MAX_LENGTH
static int
NODE_ID_MAX_LENGTH
static int
NODE_NAME_MAX_LENGTH
static String
TABLE_NAME
-
Fields inherited from class com.atlassian.bamboo.beehive.AbstractBambooRawJdbcDao
dbmsBean, hibernateConfig
-
-
Constructor Summary
Constructors Constructor Description BambooClusterNodeHeartBeatRawJdbcDao()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
deleteNode(@NotNull String nodeId)
Remove node by the given id.void
ensureNodeHeartbeatTableExists()
Creates heartbeat table if required.List<BambooNodeStatus>
findAll()
Get all heartbeats.@NotNull List<BambooNodeInfo>
findAllNodesInfo()
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
getNodeId()
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 Detail
-
NODE_ID_MAX_LENGTH
public static final int NODE_ID_MAX_LENGTH
- See Also:
- Constant Field Values
-
NODE_NAME_MAX_LENGTH
public static final int NODE_NAME_MAX_LENGTH
- See Also:
- Constant Field Values
-
NODE_HOSTNAME_MAX_LENGTH
public static final int NODE_HOSTNAME_MAX_LENGTH
- See Also:
- Constant Field Values
-
TABLE_NAME
public static final String TABLE_NAME
- See Also:
- Constant Field Values
-
-
Method Detail
-
getNodeId
@NotNull public @NotNull String 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
@Nullable public @Nullable Long getLastHeartbeatTime(@NotNull @NotNull String nodeId)
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
@NotNull public @NotNull Collection<String> findNodesWithHeartbeatsAfter(long time)
- Specified by:
findNodesWithHeartbeatsAfter
in interfaceClusterNodeHeartbeatDao
-
findNodesInfoWithHeartbeatsAfter
@NotNull public @NotNull List<BambooNodeInfo> findNodesInfoWithHeartbeatsAfter(long time)
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
public List<BambooNodeStatus> 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
@NotNull public @NotNull List<BambooNodeInfo> 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
public void deleteNode(@NotNull @NotNull String nodeId)
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
-
-