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 TypeMethodDescriptionvoidEnsures 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.booleanisActive()Returnstrueif this node is active.booleanIf there is a cluster.properties that appears to be validbooleanReturns whether or not JIRA is licensed for clustered configurations.booleanisNodeActive(@NotNull String nodeId) booleanisNodeAlive(@NotNull String nodeId) booleanisNodeOffline(@NotNull String nodeId) booleanisNodePresent(@NotNull String nodeId) moveNodesToOfflineIfOlderThan(@NotNull Duration retentionPeriod) Update nodes's state toNode.NodeState.OFFLINEif current node's state isNode.NodeState.ACTIVEand Not Alive for specified retention periodvoidmoveToOffline(@NotNull String nodeId) Update nodes's state toNode.NodeState.OFFLINEif current state isNode.NodeState.ACTIVEand Not AlivevoidvoidMerges the information from the heartbeat table and the clusternode table to give accurate information of which nodes are alive.voidremoveIfOffline(@NotNull String nodeId) Remove node from cluster if node isNode.NodeState.OFFLINEremoveOfflineNodesIfOlderThan(@NotNull Duration retentionPeriod) Remove node from cluster if node is inNode.NodeState.OFFLINEstate for specified retention periodvoidrequestCurrentIndexFromNode(String destinationNode) We send a message to the node we wish a copy from.voidstart()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:StartableThis 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:ClusterInfoProvides the node ID for this particular cluster node.- Specified by:
getNodeIdin 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:
isClusteredin interfaceClusterInfo- Returns:
- true if clustered
-
getAllNodes
Description copied from interface:ClusterManagerReturns all the nodes in the cluster. If not clustered this will return an empty set.- Specified by:
getAllNodesin interfaceClusterManager- Returns:
- a collection of
Nodes in a cluster
-
getAllNodeStatuses
- Specified by:
getAllNodeStatusesin interfaceClusterManager
-
isActive
public boolean isActive()Returnstrueif this node is active.- Specified by:
isActivein interfaceClusterManager- Returns:
trueif this node is active.
-
checkIndexOnStart
public void checkIndexOnStart()Description copied from interface:ClusterManagerEnsures Jira index is ready for the start of Jira.- Specified by:
checkIndexOnStartin interfaceClusterManager
-
requestCurrentIndexFromNode
Description copied from interface:ClusterManagerWe send a message to the node we wish a copy from.- Specified by:
requestCurrentIndexFromNodein interfaceClusterManager- Parameters:
destinationNode- Node to send the message to get an Index Copy from.
-
findLiveNodes
Description copied from interface:ClusterManagerReturns 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:
findLiveNodesin interfaceClusterManager- Returns:
- the list of nodes that are alive.
-
refreshLiveNodes
public void refreshLiveNodes()Description copied from interface:ClusterManagerMerges the information from the heartbeat table and the clusternode table to give accurate information of which nodes are alive.- Specified by:
refreshLiveNodesin interfaceClusterManager
-
onIndexesRestoredEvent
-
isClusterLicensed
public boolean isClusterLicensed()Description copied from interface:ClusterManagerReturns whether or not JIRA is licensed for clustered configurations.- Specified by:
isClusterLicensedin interfaceClusterManager- Returns:
- whether or not JIRA is licensed for clustered configurations.
-
removeIfOffline
Description copied from interface:ClusterManagerRemove node from cluster if node isNode.NodeState.OFFLINE- Specified by:
removeIfOfflinein interfaceClusterManager- Throws:
ClusterStateException- if node is not offline
-
removeOfflineNodesIfOlderThan
Description copied from interface:ClusterManagerRemove node from cluster if node is inNode.NodeState.OFFLINEstate for specified retention period- Specified by:
removeOfflineNodesIfOlderThanin interfaceClusterManager
-
moveToOffline
Description copied from interface:ClusterManagerUpdate nodes's state toNode.NodeState.OFFLINEif current state isNode.NodeState.ACTIVEand Not Alive- Specified by:
moveToOfflinein interfaceClusterManager- Throws:
ClusterStateException- if node is alive
-
moveNodesToOfflineIfOlderThan
Description copied from interface:ClusterManagerUpdate nodes's state toNode.NodeState.OFFLINEif current node's state isNode.NodeState.ACTIVEand Not Alive for specified retention period- Specified by:
moveNodesToOfflineIfOlderThanin interfaceClusterManager- Returns:
- List of nodes that was moved to
Node.NodeState.OFFLINEstate
-
isNodeAlive
- Specified by:
isNodeAlivein interfaceClusterManager- Returns:
- true if node is alive otherwise return false
-
isNodePresent
- Specified by:
isNodePresentin interfaceClusterManager- Returns:
- true if node is present in cluster otherwise return false
-
isNodeOffline
- Specified by:
isNodeOfflinein interfaceClusterManager- Returns:
- true if node is
Node.NodeState.OFFLINEotherwise return false
-
isNodeActive
- Specified by:
isNodeActivein interfaceClusterManager- Returns:
- true if node is
Node.NodeState.ACTIVEotherwise return false
-
findActiveAndNotAliveNodes
- Specified by:
findActiveAndNotAliveNodesin interfaceClusterManager- Returns:
- list of nodes that are
Node.NodeState.ACTIVEand not aliveClusterManager.isNodeAlive(java.lang.String)
-
findOfflineNodes
- Specified by:
findOfflineNodesin interfaceClusterManager- Returns:
- list of nodes that are
Node.NodeState.OFFLINE
-