Package com.atlassian.jira.cluster
Class DefaultClusterManager
java.lang.Object
com.atlassian.jira.cluster.DefaultClusterManager
- All Implemented Interfaces:
ClusterInfo
,ClusterManager
,Startable
Manages the cluster - addition of nodes, removal, etc
- Since:
- v6.1
-
Field Summary
Fields inherited from interface com.atlassian.jira.cluster.ClusterManager
ALL_NODES, ANY_NODE
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultClusterManager
(ClusterNodes clusterNodes, com.atlassian.event.api.EventPublisher eventPublisher, NodeCutOffManager nodeCutOffManager) -
Method Summary
Modifier and TypeMethodDescriptionvoid
Ensures Jira index is ready for the start of Jira.Returns a snapshot of the live nodes.Returns all the nodes in the cluster.Provides the node ID for this particular cluster node.boolean
isActive()
Returnstrue
if this node is active.boolean
If there is a cluster.properties that appears to be validboolean
Returns whether or not JIRA is licensed for clustered configurations.boolean
isNodeActive
(@NotNull String nodeId) boolean
isNodeAlive
(@NotNull String nodeId) boolean
isNodeOffline
(@NotNull String nodeId) boolean
isNodePresent
(@NotNull String nodeId) moveNodesToOfflineIfOlderThan
(@NotNull Duration retentionPeriod) Update nodes's state toNode.NodeState.OFFLINE
if current node's state isNode.NodeState.ACTIVE
and Not Alive for specified retention periodvoid
moveToOffline
(@NotNull String nodeId) Update nodes's state toNode.NodeState.OFFLINE
if current state isNode.NodeState.ACTIVE
and Not Alivevoid
void
Merges the information from the heartbeat table and the clusternode table to give accurate information of which nodes are alive.void
removeIfOffline
(@NotNull String nodeId) Remove node from cluster if node isNode.NodeState.OFFLINE
removeOfflineNodesIfOlderThan
(@NotNull Duration retentionPeriod) Remove node from cluster if node is inNode.NodeState.OFFLINE
state for specified retention periodvoid
requestCurrentIndexFromNode
(String destinationNode) We send a message to the node we wish a copy from.void
start()
This method will be called after the plugin system is fully initialised and all components added to the dependency injection framework.
-
Constructor Details
-
DefaultClusterManager
public DefaultClusterManager(ClusterNodes clusterNodes, com.atlassian.event.api.EventPublisher eventPublisher, NodeCutOffManager nodeCutOffManager)
-
-
Method Details
-
start
public void start()Description copied from interface:Startable
This method will be called after the plugin system is fully initialised and all components added to the dependency injection framework. -
getNodeId
Description copied from interface:ClusterInfo
Provides the node ID for this particular cluster node.- Specified by:
getNodeId
in interfaceClusterInfo
- Returns:
- node id - null if the server is not in a cluster
-
isClustered
public boolean isClustered()If there is a cluster.properties that appears to be valid- Specified by:
isClustered
in interfaceClusterInfo
- Returns:
- true if clustered
-
getAllNodes
Description copied from interface:ClusterManager
Returns all the nodes in the cluster. If not clustered this will return an empty set.- Specified by:
getAllNodes
in interfaceClusterManager
- Returns:
- a collection of
Node
s in a cluster
-
getAllNodeStatuses
- Specified by:
getAllNodeStatuses
in interfaceClusterManager
-
isActive
public boolean isActive()Returnstrue
if this node is active.- Specified by:
isActive
in interfaceClusterManager
- Returns:
true
if this node is active.
-
checkIndexOnStart
public void checkIndexOnStart()Description copied from interface:ClusterManager
Ensures Jira index is ready for the start of Jira.- Specified by:
checkIndexOnStart
in interfaceClusterManager
-
requestCurrentIndexFromNode
Description copied from interface:ClusterManager
We send a message to the node we wish a copy from.- Specified by:
requestCurrentIndexFromNode
in interfaceClusterManager
- Parameters:
destinationNode
- Node to send the message to get an Index Copy from.
-
findLiveNodes
Description copied from interface:ClusterManager
Returns a snapshot of the live nodes. This collection is refreshed in every heartbeat of the server. Or you can force it calling refreshLiveNodes()- Specified by:
findLiveNodes
in interfaceClusterManager
- Returns:
- the list of nodes that are alive.
-
refreshLiveNodes
public void refreshLiveNodes()Description copied from interface:ClusterManager
Merges the information from the heartbeat table and the clusternode table to give accurate information of which nodes are alive.- Specified by:
refreshLiveNodes
in interfaceClusterManager
-
onIndexesRestoredEvent
-
isClusterLicensed
public boolean isClusterLicensed()Description copied from interface:ClusterManager
Returns whether or not JIRA is licensed for clustered configurations.- Specified by:
isClusterLicensed
in interfaceClusterManager
- Returns:
- whether or not JIRA is licensed for clustered configurations.
-
removeIfOffline
Description copied from interface:ClusterManager
Remove node from cluster if node isNode.NodeState.OFFLINE
- Specified by:
removeIfOffline
in interfaceClusterManager
- Throws:
ClusterStateException
- if node is not offline
-
removeOfflineNodesIfOlderThan
Description copied from interface:ClusterManager
Remove node from cluster if node is inNode.NodeState.OFFLINE
state for specified retention period- Specified by:
removeOfflineNodesIfOlderThan
in interfaceClusterManager
-
moveToOffline
Description copied from interface:ClusterManager
Update nodes's state toNode.NodeState.OFFLINE
if current state isNode.NodeState.ACTIVE
and Not Alive- Specified by:
moveToOffline
in interfaceClusterManager
- Throws:
ClusterStateException
- if node is alive
-
moveNodesToOfflineIfOlderThan
Description copied from interface:ClusterManager
Update nodes's state toNode.NodeState.OFFLINE
if current node's state isNode.NodeState.ACTIVE
and Not Alive for specified retention period- Specified by:
moveNodesToOfflineIfOlderThan
in interfaceClusterManager
- Returns:
- List of nodes that was moved to
Node.NodeState.OFFLINE
state
-
isNodeAlive
- Specified by:
isNodeAlive
in interfaceClusterManager
- Returns:
- true if node is alive otherwise return false
-
isNodePresent
- Specified by:
isNodePresent
in interfaceClusterManager
- Returns:
- true if node is present in cluster otherwise return false
-
isNodeOffline
- Specified by:
isNodeOffline
in interfaceClusterManager
- Returns:
- true if node is
Node.NodeState.OFFLINE
otherwise return false
-
isNodeActive
- Specified by:
isNodeActive
in interfaceClusterManager
- Returns:
- true if node is
Node.NodeState.ACTIVE
otherwise return false
-
findActiveAndNotAliveNodes
- Specified by:
findActiveAndNotAliveNodes
in interfaceClusterManager
- Returns:
- list of nodes that are
Node.NodeState.ACTIVE
and not aliveClusterManager.isNodeAlive(java.lang.String)
-
findOfflineNodes
- Specified by:
findOfflineNodes
in interfaceClusterManager
- Returns:
- list of nodes that are
Node.NodeState.OFFLINE
-