public class DefaultClusterManager extends Object implements ClusterManager, Startable
ALL_NODES, ANY_NODE| Constructor and Description |
|---|
DefaultClusterManager(ClusterNodes clusterNodes,
com.atlassian.event.api.EventPublisher eventPublisher,
ClusterLicenseCheck licenseCheck,
MessageHandlerService messageHandlerService,
NodeCutOffManager nodeCutOffManager,
JiraProperties jiraProperties,
com.atlassian.upgrade.spi.UpgradeTaskFactory upgradeTaskFactory,
BuildUtilsInfo buildUtilsInfo) |
| Modifier and Type | Method and Description |
|---|---|
void |
checkIndexOnStart()
Ensures Jira index is ready for the start of Jira.
|
List<Node> |
findActiveAndNotAliveNodes() |
Collection<Node> |
findLiveNodes()
Returns a snapshot of the live nodes.
|
List<Node> |
findOfflineNodes() |
Set<Node> |
getAllNodes()
Returns all the nodes in the cluster.
|
Set<NodeStatus> |
getAllNodeStatuses() |
String |
getNodeId()
Provides the node ID for this particular cluster node.
|
boolean |
isActive()
Returns
true if this node is active. |
boolean |
isClustered()
If there is a cluster.properties that appears to be valid
|
boolean |
isClusterLicensed()
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) |
List<String> |
moveNodesToOfflineIfOlderThan(@NotNull java.time.Duration retentionPeriod)
Update nodes's state to
Node.NodeState.OFFLINE if current node's state is Node.NodeState.ACTIVE and Not Alive for specified retention period |
void |
moveToOffline(@NotNull String nodeId)
Update nodes's state to
Node.NodeState.OFFLINE if current state is Node.NodeState.ACTIVE and Not Alive |
void |
onIndexesRestoredEvent(IndexesRestoredEvent ev) |
void |
refreshLiveNodes()
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 is
Node.NodeState.OFFLINE |
List<String> |
removeOfflineNodesIfOlderThan(@NotNull java.time.Duration retentionPeriod)
Remove node from cluster if node is in
Node.NodeState.OFFLINE state for specified retention period |
void |
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.
|
public DefaultClusterManager(ClusterNodes clusterNodes, com.atlassian.event.api.EventPublisher eventPublisher, ClusterLicenseCheck licenseCheck, MessageHandlerService messageHandlerService, NodeCutOffManager nodeCutOffManager, JiraProperties jiraProperties, com.atlassian.upgrade.spi.UpgradeTaskFactory upgradeTaskFactory, BuildUtilsInfo buildUtilsInfo)
public void start()
Startable@Nullable public String getNodeId()
ClusterInfogetNodeId in interface ClusterInfopublic boolean isClustered()
isClustered in interface ClusterInfopublic Set<Node> getAllNodes()
ClusterManagergetAllNodes in interface ClusterManagerNodes in a clusterpublic Set<NodeStatus> getAllNodeStatuses()
getAllNodeStatuses in interface ClusterManagerpublic boolean isActive()
true if this node is active.isActive in interface ClusterManagertrue if this node is active.public void checkIndexOnStart()
ClusterManagercheckIndexOnStart in interface ClusterManagerpublic void requestCurrentIndexFromNode(String destinationNode)
ClusterManagerrequestCurrentIndexFromNode in interface ClusterManagerdestinationNode - Node to send the message to get an Index Copy from.public Collection<Node> findLiveNodes()
ClusterManagerfindLiveNodes in interface ClusterManagerpublic void refreshLiveNodes()
ClusterManagerrefreshLiveNodes in interface ClusterManager@EventListener public void onIndexesRestoredEvent(IndexesRestoredEvent ev)
public boolean isClusterLicensed()
ClusterManagerisClusterLicensed in interface ClusterManagerpublic void removeIfOffline(@NotNull
@NotNull String nodeId)
throws ClusterStateException
ClusterManagerNode.NodeState.OFFLINEremoveIfOffline in interface ClusterManagerClusterStateException - if node is not offlinepublic List<String> removeOfflineNodesIfOlderThan(@NotNull @NotNull java.time.Duration retentionPeriod)
ClusterManagerNode.NodeState.OFFLINE state for specified retention periodremoveOfflineNodesIfOlderThan in interface ClusterManagerpublic void moveToOffline(@NotNull
@NotNull String nodeId)
throws ClusterStateException
ClusterManagerNode.NodeState.OFFLINE if current state is Node.NodeState.ACTIVE and Not AlivemoveToOffline in interface ClusterManagerClusterStateException - if node is alivepublic List<String> moveNodesToOfflineIfOlderThan(@NotNull @NotNull java.time.Duration retentionPeriod)
ClusterManagerNode.NodeState.OFFLINE if current node's state is Node.NodeState.ACTIVE and Not Alive for specified retention periodmoveNodesToOfflineIfOlderThan in interface ClusterManagerNode.NodeState.OFFLINE statepublic boolean isNodeAlive(@NotNull
@NotNull String nodeId)
isNodeAlive in interface ClusterManagerpublic boolean isNodePresent(@NotNull
@NotNull String nodeId)
isNodePresent in interface ClusterManagerpublic boolean isNodeOffline(@NotNull
@NotNull String nodeId)
isNodeOffline in interface ClusterManagerNode.NodeState.OFFLINE otherwise return falsepublic boolean isNodeActive(@NotNull
@NotNull String nodeId)
isNodeActive in interface ClusterManagerNode.NodeState.ACTIVE otherwise return falsepublic List<Node> findActiveAndNotAliveNodes()
findActiveAndNotAliveNodes in interface ClusterManagerNode.NodeState.ACTIVE and not alive ClusterManager.isNodeAlive(java.lang.String)public List<Node> findOfflineNodes()
findOfflineNodes in interface ClusterManagerNode.NodeState.OFFLINECopyright © 2002-2024 Atlassian. All Rights Reserved.