public class DefaultClusterNodes extends Object implements ClusterNodes
Constructor and Description |
---|
DefaultClusterNodes(ClusterNodeProperties clusterNodeProperties,
OfBizClusterNodeStore ofBizClusterNodeStore,
BuildUtilsInfo buildUtilsInfo,
ClusterNodeAuditHandler clusterNodeAuditHandler) |
Modifier and Type | Method and Description |
---|---|
Set<Node> |
all()
Returns all the known nodes in a JIRA cluster.
|
protected String |
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
|
Node |
current()
Returns the current cluster node in JIRA.
|
protected Long |
getCacheListenerPort() |
String |
getHostname()
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 nonalive
|
Node |
node(String nodeId) |
void |
removeIfOffline(@NotNull String nodeId)
Remove node from cluster if node is OFFLINE
|
void |
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.
|
public DefaultClusterNodes(ClusterNodeProperties clusterNodeProperties, OfBizClusterNodeStore ofBizClusterNodeStore, BuildUtilsInfo buildUtilsInfo, ClusterNodeAuditHandler clusterNodeAuditHandler)
public Node current()
ClusterNodes
current
in interface ClusterNodes
Node.isClustered()
to see if it's part of a
cluster.public void reset()
ClusterNodes
reset
in interface ClusterNodes
public Set<Node> all()
ClusterNodes
all
in interface ClusterNodes
Node
s in a cluster.@Nullable public Node node(String nodeId)
node
in interface ClusterNodes
Node
with given nodeID; note that this method may be eventually consistentprotected boolean stateHasChanged(Node node)
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
node
- the nodeprotected Long getCacheListenerPort()
protected String buildHostname()
public String getHostname()
ClusterNodes
getHostname
in interface ClusterNodes
NetworkUtils.getLocalHostName()
public void removeIfOffline(@NotNull @NotNull String nodeId) throws ClusterStateException
ClusterNodes
removeIfOffline
in interface ClusterNodes
ClusterStateException
- if node is not offline or we are not able to remove nodepublic void moveToOffline(@NotNull @NotNull String nodeId) throws ClusterStateException
ClusterNodes
moveToOffline
in interface ClusterNodes
ClusterStateException
- if node is aliveCopyright © 2002-2021 Atlassian. All Rights Reserved.