Package com.atlassian.jira.cluster
Class DefaultClusterNodes
java.lang.Object
com.atlassian.jira.cluster.DefaultClusterNodes
- All Implemented Interfaces:
ClusterNodes
- Since:
- v7.0.6
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultClusterNodes(ClusterNodeProperties clusterNodeProperties, OfBizClusterNodeStore ofBizClusterNodeStore, BuildUtilsInfo buildUtilsInfo, ClusterNodeAuditHandler clusterNodeAuditHandler) -
Method Summary
Modifier and TypeMethodDescriptionall()Returns all the known nodes in a JIRA cluster.protected StringWe are going to evaluate if the user set a hostname in the .properties file if that is the case then we need to use that one all over the clustercurrent()Returns the current cluster node in JIRA.protected LongReturns the IP/hostname configured to be used for this JIRA Cluster.voidmoveToOffline(@NotNull String nodeId) Update nodes's state to OFFLINE if current state is ACTIVE and nonalivevoidremoveIfOffline(@NotNull String nodeId) Remove node from cluster if node is OFFLINEvoidreset()Resets the cached reference to the current cluster node.protected booleanstateHasChanged(Node node) We validate if the state of the node has changed.
-
Constructor Details
-
DefaultClusterNodes
public DefaultClusterNodes(ClusterNodeProperties clusterNodeProperties, OfBizClusterNodeStore ofBizClusterNodeStore, BuildUtilsInfo buildUtilsInfo, ClusterNodeAuditHandler clusterNodeAuditHandler)
-
-
Method Details
-
current
Description copied from interface:ClusterNodesReturns the current cluster node in JIRA.- Specified by:
currentin interfaceClusterNodes- Returns:
- a non-null instance; call
Node.isClustered()to see if it's part of a cluster.
-
reset
public void reset()Description copied from interface:ClusterNodesResets the cached reference to the current cluster node.- Specified by:
resetin interfaceClusterNodes
-
all
Description copied from interface:ClusterNodesReturns all the known nodes in a JIRA cluster. If not clustered this will return an empty set.- Specified by:
allin interfaceClusterNodes- Returns:
- a collection of
Nodes in a cluster.
-
node
- Specified by:
nodein interfaceClusterNodes- Returns:
Nodewith given nodeID; note that this method may be eventually consistent
-
stateHasChanged
We validate if the state of the node has changed.1) if the node is in offline state in the db, and we are initializing it. 2) if the node has a different IP address. 3) if the port of multicasting has changed
- Parameters:
node- the node- Returns:
- true if the state has changed, false if not
-
getCacheListenerPort
-
buildHostname
We are going to evaluate if the user set a hostname in the .properties file if that is the case then we need to use that one all over the cluster- Returns:
- the ip/hostname
-
getHostname
Description copied from interface:ClusterNodesReturns the IP/hostname configured to be used for this JIRA Cluster. If none is configured, localhost is returned.- Specified by:
getHostnamein interfaceClusterNodes- Returns:
- The IP/hostname configured to be used for this JIRA Cluster.
- See Also:
-
removeIfOffline
Description copied from interface:ClusterNodesRemove node from cluster if node is OFFLINE- Specified by:
removeIfOfflinein interfaceClusterNodes- Throws:
ClusterStateException- if node is not offline or we are not able to remove node
-
moveToOffline
Description copied from interface:ClusterNodesUpdate nodes's state to OFFLINE if current state is ACTIVE and nonalive- Specified by:
moveToOfflinein interfaceClusterNodes- Throws:
ClusterStateException- if node is alive
-