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 String
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 clustercurrent()
Returns the current cluster node in JIRA.protected Long
Returns the IP/hostname configured to be used for this JIRA Cluster.void
moveToOffline
(@NotNull String nodeId) Update nodes's state to OFFLINE if current state is ACTIVE and nonalivevoid
removeIfOffline
(@NotNull String nodeId) Remove node from cluster if node is OFFLINEvoid
reset()
Resets the cached reference to the current cluster node.protected boolean
stateHasChanged
(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:ClusterNodes
Returns the current cluster node in JIRA.- Specified by:
current
in 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:ClusterNodes
Resets the cached reference to the current cluster node.- Specified by:
reset
in interfaceClusterNodes
-
all
Description copied from interface:ClusterNodes
Returns all the known nodes in a JIRA cluster. If not clustered this will return an empty set.- Specified by:
all
in interfaceClusterNodes
- Returns:
- a collection of
Node
s in a cluster.
-
node
- Specified by:
node
in interfaceClusterNodes
- Returns:
Node
with 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:ClusterNodes
Returns the IP/hostname configured to be used for this JIRA Cluster. If none is configured, localhost is returned.- Specified by:
getHostname
in interfaceClusterNodes
- Returns:
- The IP/hostname configured to be used for this JIRA Cluster.
- See Also:
-
removeIfOffline
Description copied from interface:ClusterNodes
Remove node from cluster if node is OFFLINE- Specified by:
removeIfOffline
in interfaceClusterNodes
- Throws:
ClusterStateException
- if node is not offline or we are not able to remove node
-
moveToOffline
Description copied from interface:ClusterNodes
Update nodes's state to OFFLINE if current state is ACTIVE and nonalive- Specified by:
moveToOffline
in interfaceClusterNodes
- Throws:
ClusterStateException
- if node is alive
-