Package com.atlassian.confluence.cluster
Interface ClusterManager
-
- All Superinterfaces:
LockFactory
- All Known Implementing Classes:
HazelcastClusterManager
public interface ClusterManager extends LockFactory
-
-
Field Summary
Fields Modifier and Type Field Description static String
DEFAULT_EXECUTOR_SVC_NAME
Default 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 void
configure(ClusterConfig config)
Set a new cluster configuration.Collection<ClusterNodeInformation>
getAllNodesInformation()
ClusteredLock
getClusteredLock(String key)
Deprecated.since 5.6 UseClusterLockService.getLockForName(String)
instead.ClusterInformation
getClusterInformation()
Deprecated, for removal: This API element is subject to removal in a future version.since 8.2ClusterInvariants
getClusterInvariants()
Get all attributes of the server that must be consistent between the nodes of a stable cluster.long
getClusterUptime()
Gets the amount of time that the cluster has been running.<T> com.atlassian.core.task.FifoBuffer<T>
getFifoBuffer(String name)
Deprecated, for removal: This API element is subject to removal in a future version.since 8.2Map<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()
GetsCompletionStage
of status information from all members of the cluster.@Nullable ClusterNodeInformation
getThisNodeInformation()
Get the identity of this node in the cluster.boolean
isClustered()
boolean
isClusterSupported()
Check whether this Confluence distribution is capable of running in a cluster.boolean
isConfigured()
void
publishEvent(ConfluenceEvent event)
Publish an event as a ClusterEventWrapper to other nodesvoid
publishEventImmediately(ConfluenceEvent event)
Publish immediately, an event as a ClusterEventWrapper to other nodesvoid
reconfigure(ClusterConfig config)
Set a new cluster configuration and cycle the servicevoid
startCluster()
Start the clustering servicevoid
stopCluster()
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
-
-
-
-
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
@Deprecated(since="8.2", forRemoval=true) ClusterInformation getClusterInformation()
Deprecated, for removal: This API element is subject to removal in a future version.since 8.2Get 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
@Deprecated(since="8.2", forRemoval=true) <T> com.atlassian.core.task.FifoBuffer<T> getFifoBuffer(String name)
Deprecated, for removal: This API element is subject to removal in a future version.since 8.2Get 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) throws ClusterException
Set a new cluster configuration and cycle the service- Parameters:
config
-- Throws:
ClusterException
-
stopCluster
void stopCluster()
Stop the clustering service
-
startCluster
void startCluster() throws ClusterException
Start the clustering service- Throws:
ClusterException
-
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()
GetsCompletionStage
of status information from all members of the cluster.- Since:
- 7.9
-
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 beSerializable
serviceName
- 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 beSerializable
serviceName
- 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
-
-