public class

DefaultNodeStateManager

extends Object
implements NodeStateManager
java.lang.Object
   ↳ com.atlassian.jira.cluster.DefaultNodeStateManager

Class Overview

Manage the state of the current node. The activate() and deactivate() methods are synchronised as we should only ever be running one of those methods at a time to avoid weird race conditions that would be possible if we tried to go from active to passive and vice-versa at the same time.

Summary

Public Constructors
DefaultNodeStateManager(OfBizClusterNodeStore ofBizClusterNodeStore, ClusterNodes clusterNodes, ClusterNodeProperties clusterNodeProperties, LifecycleAwareSchedulerService schedulerService, ComponentFactory componentFactory, MailQueue mailQueue, EventPublisher eventPublisher, JiraSystemRestarter jiraSystemRestarter, CacheManager cacheManager)
Public Methods
synchronized void activate()
Activate the node.
@EventListener void clearCache(ClearCacheEvent event)
synchronized void deactivate()
Deactivate the node.
Set<Node> getAllNodes()
Returns all the known nodes JIRA node.
Node getNode()
Returns the current JIRA node.
Node getNodeWithRefresh()
Returns the current JIRA node, first refreshing its state from the database.
synchronized void quiesce()
There are times when you want the server to go into a deep sleep mode, such as when an import is taking place on the cluster.
void restart()
void shutdownNode()
We are going to change the state when the component manager stops so the other nodes do not get alerts about this node
Protected Methods
Long getCacheListenerPort()
boolean stateHasChanged(Node node)
We validate if the state of the node has changed.
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.atlassian.jira.cluster.NodeStateManager

Public Constructors

public DefaultNodeStateManager (OfBizClusterNodeStore ofBizClusterNodeStore, ClusterNodes clusterNodes, ClusterNodeProperties clusterNodeProperties, LifecycleAwareSchedulerService schedulerService, ComponentFactory componentFactory, MailQueue mailQueue, EventPublisher eventPublisher, JiraSystemRestarter jiraSystemRestarter, CacheManager cacheManager)

Public Methods

public synchronized void activate ()

Activate the node. This method will block until the node becomes active.

@EventListener public void clearCache (ClearCacheEvent event)

public synchronized void deactivate ()

Deactivate the node. This method will block until the node becomes inactive (passive).

public Set<Node> getAllNodes ()

Returns all the known nodes JIRA node. If not clustered this will return an empty set.

Returns
  • a collection of Nodes in a cluster

public Node getNode ()

Returns the current JIRA node.

Returns
  • a non-null instance; call isClustered() to see if it's part of a cluster

public Node getNodeWithRefresh ()

Returns the current JIRA node, first refreshing its state from the database.

Returns
  • a non-null instance; call isClustered() to see if it's part of a cluster

public synchronized void quiesce ()

There are times when you want the server to go into a deep sleep mode, such as when an import is taking place on the cluster.

public void restart ()

public void shutdownNode ()

We are going to change the state when the component manager stops so the other nodes do not get alerts about this node

Protected Methods

protected Long getCacheListenerPort ()

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