Package com.atlassian.confluence.cluster
Interface ClusterManager
-
- All Superinterfaces:
LockFactory,NameResolver
- All Known Implementing Classes:
HazelcastClusterManager
public interface ClusterManager extends NameResolver, LockFactory
-
-
Field Summary
Fields Modifier and Type Field Description static StringDEFAULT_EXECUTOR_SVC_NAMEDefault name of the executor service to use for executing tasks.
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description voidconfigure(ClusterConfig config)Set a new cluster configuration.Collection<ClusterNodeInformation>getAllNodesInformation()ClusteredLockgetClusteredLock(String key)Deprecated.since 5.6 UseClusterLockService.getLockForName(String)instead.ClusterInformationgetClusterInformation()Get information about the running cluster.ClusterInvariantsgetClusterInvariants()Get all attributes of the server that must be consistent between the nodes of a stable cluster.ClusterMembershipCriteriagetClusterMembershipCriteria()Deprecated.since 7.13.longgetClusterUptime()Gets the amount of time that the cluster has been running.<T> com.atlassian.core.task.FifoBuffer<T>getFifoBuffer(String name)Get a distributed FIFO bufferMap<Integer,NodeStatus>getNodeStatuses()Deprecated.since 5.5 UsegetNodeStatusMap()Map<ClusterNodeInformation,NodeStatus>getNodeStatusMap()Gets status information from all members of the cluster.Map<ClusterNodeInformation,CompletionStage<NodeStatus>>getNodeStatusMapAsync()GetsCompletionStageof status information from all members of the cluster.@Nullable ClusterNodeInformationgetThisNodeInformation()Get the identity of this node in the cluster.booleanisClustered()booleanisClusterSupported()Check whether this Confluence distribution is capable of running in a cluster.booleanisConfigured()voidpublishEvent(ConfluenceEvent event)Publish an event as a ClusterEventWrapper to other nodesvoidpublishEventImmediately(ConfluenceEvent event)Publish immediately, an event as a ClusterEventWrapper to other nodesvoidreconfigure(ClusterConfig config)Set a new cluster configuration and cycle the servicevoidstartCluster()Start the clustering servicevoidstopCluster()Stop the clustering service<T> List<ClusterNodeExecution<T>>submitToAllNodes(Callable<T> task, String serviceName)Submit a task to be executed on all nodes in the cluster.<T> CompletionStage<T>submitToKeyOwner(Callable<T> task, String serviceName, Object key)Submit a task to be executed by a service given by its name on one node of the cluster that own a given key.<T> ClusterNodeExecution<T>submitToNode(@Nullable String nodeId, Callable<T> task, String serviceName)Submit a task to be executed on a node with the specified ID-
Methods inherited from interface com.atlassian.confluence.concurrent.LockFactory
getLock
-
Methods inherited from interface com.atlassian.confluence.cluster.NameResolver
resolveName
-
-
-
-
Field Detail
-
DEFAULT_EXECUTOR_SVC_NAME
static final String DEFAULT_EXECUTOR_SVC_NAME
Default name of the executor service to use for executing tasks.- Since:
- 7.14
- See Also:
- Constant Field Values
-
-
Method Detail
-
isClusterSupported
boolean isClusterSupported()
Check whether this Confluence distribution is capable of running in a cluster. This differs fromisClustered()in that it will return true if the code to support clustering is present, even if this instance does not have a clustered license or a current clustering configuration.- Returns:
- true if this Confluence installation is capable of running in a cluster
-
isClustered
@EnsuresNonNullIf(expression="getThisNodesInformation()", result=true) boolean isClustered()- Returns:
- true if this instance is configured to allow clustering with other nodes. Note, this does not mean this instance is licensed to cluster.
-
getClusterInformation
ClusterInformation getClusterInformation()
Get information about the running cluster.
-
getClusteredLock
@Deprecated ClusteredLock getClusteredLock(String key)
Deprecated.since 5.6 UseClusterLockService.getLockForName(String)instead.Get a distributed lock -- getting the lock does *not* imply that it has been acquired. CallLock.tryLock()orLock.lock()on the returned object to acquire the lock.
-
getFifoBuffer
<T> com.atlassian.core.task.FifoBuffer<T> getFifoBuffer(String name)
Get a distributed FIFO buffer
-
publishEvent
void publishEvent(ConfluenceEvent event)
Publish an event as a ClusterEventWrapper to other nodesThis waits for any current transaction to be committed successfully before scheduling the event for publishing.
-
publishEventImmediately
void publishEventImmediately(ConfluenceEvent event)
Publish immediately, an event as a ClusterEventWrapper to other nodesThis is done immediately regardless of the state of any current transactions.
-
getThisNodeInformation
@Nullable ClusterNodeInformation getThisNodeInformation()
Get the identity of this node in the cluster. ClusterNodeInformation implements equals().
- Returns:
- the identity of this node in the cluster. May return null if the node is not in a cluster.
-
getAllNodesInformation
Collection<ClusterNodeInformation> getAllNodesInformation()
-
configure
void configure(ClusterConfig config)
Set a new cluster configuration.- Parameters:
config-
-
isConfigured
boolean isConfigured()
- Returns:
- true if
configure(ClusterConfig)has been called with a valid configuration, otherwise false.
-
reconfigure
void reconfigure(ClusterConfig config)
Set a new cluster configuration and cycle the service- Parameters:
config-
-
stopCluster
void stopCluster()
Stop the clustering service
-
startCluster
void startCluster()
Start the clustering service
-
getNodeStatuses
@Deprecated Map<Integer,NodeStatus> getNodeStatuses()
Deprecated.since 5.5 UsegetNodeStatusMap()Gets status information from all members of the cluster.- Returns:
- a map of node IDs to node statuses
-
getNodeStatusMap
Map<ClusterNodeInformation,NodeStatus> getNodeStatusMap()
Gets status information from all members of the cluster.- Since:
- 5.6
-
getNodeStatusMapAsync
Map<ClusterNodeInformation,CompletionStage<NodeStatus>> getNodeStatusMapAsync()
GetsCompletionStageof status information from all members of the cluster.- Since:
- 7.9
-
getClusterMembershipCriteria
@Deprecated ClusterMembershipCriteria getClusterMembershipCriteria() throws ClusterException
Deprecated.since 7.13. UsegetClusterInvariants()instead.Get all attributes of the server that must be used as criteria when determining whether a new node can join this cluster. They are to be retrieved from another member in the cluster. If there are no other members currently active in the cluster, then return null.- Returns:
- the cluster membership criteria of this server
- Throws:
ClusterException- if the criteria cannot be gathered for some reason
-
getClusterInvariants
ClusterInvariants getClusterInvariants() throws ClusterException
Get all attributes of the server that must be consistent between the nodes of a stable cluster. They are to be retrieved from another member in the cluster. If there are no other members currently active in the cluster, then return null.- Returns:
- the cluster invariants of this server
- Throws:
ClusterException- if the invariants can not be gathered for some reason
-
submitToKeyOwner
<T> CompletionStage<T> submitToKeyOwner(Callable<T> task, String serviceName, Object key)
Submit a task to be executed by a service given by its name on one node of the cluster that own a given key.- Parameters:
task- task to be executed on the node that owns the provided key, it must beSerializableserviceName- name of service used to execute the taskkey- key used to determined which node is going to execute the task, it must beSerializable- Returns:
- CompletionStage
- Since:
- 6.5
-
submitToNode
<T> ClusterNodeExecution<T> submitToNode(@Nullable String nodeId, Callable<T> task, String serviceName) throws NoSuchClusterNodeException
Submit a task to be executed on a node with the specified ID- Parameters:
nodeId- ID of the node that should execute the task. If null, task will be executed locally.task- task to be executed on the specified nodeserviceName- name of service used to execute the task- Returns:
- node execution result
- Throws:
NoSuchClusterNodeException- if there's no node in the cluster with the specified ID- Since:
- 7.18
-
submitToAllNodes
<T> List<ClusterNodeExecution<T>> submitToAllNodes(Callable<T> task, String serviceName)
Submit a task to be executed on all nodes in the cluster.- Parameters:
task- task to be executed on the node that owns the provided key, it must beSerializableserviceName- name of service used to execute the task- Returns:
- List of
ClusterNodeExecution, one element from each node - Since:
- 7.14
-
getClusterUptime
long getClusterUptime()
Gets the amount of time that the cluster has been running.- Returns:
- the time in milliseconds since the first node in the cluster came up, or the node uptime if not clustered.
- Since:
- 6.11
-
-