Class DefaultClusterNodes

java.lang.Object
com.atlassian.jira.cluster.DefaultClusterNodes
All Implemented Interfaces:
ClusterNodes

public class DefaultClusterNodes extends Object implements ClusterNodes
Since:
v7.0.6
  • Constructor Details

  • Method Details

    • current

      public Node current()
      Description copied from interface: ClusterNodes
      Returns the current cluster node in JIRA.
      Specified by:
      current in interface ClusterNodes
      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 interface ClusterNodes
    • all

      public Set<Node> 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 interface ClusterNodes
      Returns:
      a collection of Nodes in a cluster.
    • node

      @Nullable public Node node(String nodeId)
      Specified by:
      node in interface ClusterNodes
      Returns:
      Node with given nodeID; note that this method may be eventually consistent
    • stateHasChanged

      protected boolean stateHasChanged(Node node)
      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

      protected Long getCacheListenerPort()
    • buildHostname

      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
      Returns:
      the ip/hostname
    • getHostname

      public String 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 interface ClusterNodes
      Returns:
      The IP/hostname configured to be used for this JIRA Cluster.
      See Also:
      • NetworkUtils.getLocalHostName()
    • removeIfOffline

      public void removeIfOffline(@NotNull @NotNull String nodeId) throws ClusterStateException
      Description copied from interface: ClusterNodes
      Remove node from cluster if node is OFFLINE
      Specified by:
      removeIfOffline in interface ClusterNodes
      Throws:
      ClusterStateException - if node is not offline or we are not able to remove node
    • moveToOffline

      public void moveToOffline(@NotNull @NotNull String nodeId) throws ClusterStateException
      Description copied from interface: ClusterNodes
      Update nodes's state to OFFLINE if current state is ACTIVE and nonalive
      Specified by:
      moveToOffline in interface ClusterNodes
      Throws:
      ClusterStateException - if node is alive