com.atlassian.jira.cluster
Class DefaultNodeStateManager

java.lang.Object
  extended by com.atlassian.jira.cluster.DefaultNodeStateManager
All Implemented Interfaces:
NodeStateManager

public class DefaultNodeStateManager
extends Object
implements NodeStateManager

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.

Since:
v6.1

Constructor Summary
DefaultNodeStateManager(OfBizClusterNodeStore ofBizClusterNodeStore, ClusterNodeProperties clusterNodeProperties, com.atlassian.scheduler.core.LifecycleAwareSchedulerService schedulerService, ComponentFactory componentFactory, TaskManager taskManager, com.atlassian.mail.queue.MailQueue mailQueue, com.atlassian.event.api.EventPublisher eventPublisher, TransactionSupport transactionSupport, JiraSystemRestarter jiraSystemRestarter, com.atlassian.cache.CacheManager cacheManager)
           
 
Method Summary
 void activate()
          Activate the node.
 void clearCache(ClearCacheEvent event)
           
 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.
 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()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultNodeStateManager

public DefaultNodeStateManager(OfBizClusterNodeStore ofBizClusterNodeStore,
                               ClusterNodeProperties clusterNodeProperties,
                               com.atlassian.scheduler.core.LifecycleAwareSchedulerService schedulerService,
                               ComponentFactory componentFactory,
                               TaskManager taskManager,
                               com.atlassian.mail.queue.MailQueue mailQueue,
                               com.atlassian.event.api.EventPublisher eventPublisher,
                               TransactionSupport transactionSupport,
                               JiraSystemRestarter jiraSystemRestarter,
                               com.atlassian.cache.CacheManager cacheManager)
Method Detail

clearCache

@EventListener
public void clearCache(ClearCacheEvent event)

getNode

public Node getNode()
Description copied from interface: NodeStateManager
Returns the current JIRA node.

Specified by:
getNode in interface NodeStateManager
Returns:
a non-null instance; call Node.isClustered() to see if it's part of a cluster

getNodeWithRefresh

public Node getNodeWithRefresh()
Description copied from interface: NodeStateManager
Returns the current JIRA node, first refreshing its state from the database.

Specified by:
getNodeWithRefresh in interface NodeStateManager
Returns:
a non-null instance; call Node.isClustered() to see if it's part of a cluster

getAllNodes

public Set<Node> getAllNodes()
Description copied from interface: NodeStateManager
Returns all the known nodes JIRA node. If not clustered this will return an empty set.

Specified by:
getAllNodes in interface NodeStateManager
Returns:
a collection of Nodes in a cluster

activate

public void activate()
              throws ClusterStateException
Description copied from interface: NodeStateManager
Activate the node. This method will block until the node becomes active.

Specified by:
activate in interface NodeStateManager
Throws:
ClusterStateException - when we can't become active as requested

quiesce

public void quiesce()
             throws NotClusteredException
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.

Specified by:
quiesce in interface NodeStateManager
Throws:
NotClusteredException

restart

public void restart()
Specified by:
restart in interface NodeStateManager

deactivate

public void deactivate()
                throws NotClusteredException
Description copied from interface: NodeStateManager
Deactivate the node. This method will block until the node becomes inactive (passive).

Specified by:
deactivate in interface NodeStateManager
Throws:
NotClusteredException - if the instance is not clustered


Copyright © 2002-2014 Atlassian. All Rights Reserved.