Class HazelcastClusterManager
java.lang.Object
com.atlassian.confluence.cluster.hazelcast.HazelcastClusterManager
- All Implemented Interfaces:
com.atlassian.beehive.ClusterLockService,ClusterConfigurationAccessor,ClusterExecutionService,ClusterManager,ClusterManagerInternal
@ParametersAreNonnullByDefault
@Internal
public class HazelcastClusterManager
extends Object
implements ClusterManagerInternal, com.atlassian.beehive.ClusterLockService, ClusterConfigurationAccessor
Hazelcast implementation of
ClusterManager- Since:
- 5.6
-
Field Summary
Fields inherited from interface com.atlassian.confluence.cluster.ClusterExecutionService
DEFAULT_EXECUTOR_SVC_NAME -
Constructor Summary
ConstructorsConstructorDescriptionHazelcastClusterManager(HazelcastConfigurationAccessor configurationAccessor, ClassLoader classLoader, String configResourceName, SynchronizationManager synchronizationManager, com.atlassian.hazelcast.serialization.OsgiSafeStreamSerializer osgiSafeStreamSerializer, com.hazelcast.core.OutOfMemoryHandler outOfMemoryHandler, io.micrometer.core.instrument.MeterRegistry micrometerRegistry, MBeanServer mbeanServer) -
Method Summary
Modifier and TypeMethodDescriptionvoidconfigure(ClusterConfig clusterConfig) Set a new cluster configuration.Deprecated, for removal: This API element is subject to removal in a future version.since 8.2Get all attributes of the server that must be consistent between the nodes of a stable cluster.longGets the amount of time that the cluster has been running.com.atlassian.beehive.ClusterLockgetLockForName(@NonNull String key) Gets status information from all members of the cluster.Get the value of config propertyconfluence.cluster.authentication.secretfrom confluence.cfg.xmlGet the identity of this node in the cluster.voidbooleanbooleanbooleanGet the value of config propertyconfluence.cluster.authentication.enabledfrom confluence.cfg.xmlvoidpublishEvent(ConfluenceEvent event) Publish an event as a ClusterEventWrapper to other nodesvoidPublish immediately, an event as a ClusterEventWrapper to other nodesvoidreconfigure(ClusterConfig config) Set a new cluster configuration and cycle the servicevoidStart the clustering servicevoidStop 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
-
Constructor Details
-
HazelcastClusterManager
public HazelcastClusterManager(HazelcastConfigurationAccessor configurationAccessor, ClassLoader classLoader, String configResourceName, SynchronizationManager synchronizationManager, com.atlassian.hazelcast.serialization.OsgiSafeStreamSerializer osgiSafeStreamSerializer, com.hazelcast.core.OutOfMemoryHandler outOfMemoryHandler, io.micrometer.core.instrument.MeterRegistry micrometerRegistry, MBeanServer mbeanServer)
-
-
Method Details
-
initOutOfmemoryhandler
@PostConstruct public void initOutOfmemoryhandler() -
getClusterUptime
public long getClusterUptime()Description copied from interface:ClusterManagerGets the amount of time that the cluster has been running.- Specified by:
getClusterUptimein interfaceClusterManager- Returns:
- the time in milliseconds since the first node in the cluster came up, or the node uptime if not clustered.
-
isClustered
public boolean isClustered()- Specified by:
isClusteredin interfaceClusterConfigurationAccessor- Specified by:
isClusteredin interfaceClusterManager- 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, for removal: This API element is subject to removal in a future version.since 8.2Description copied from interface:ClusterManagerGet information about the running cluster.- Specified by:
getClusterInformationin interfaceClusterManager
-
publishEvent
Description copied from interface:ClusterManagerPublish an event as a ClusterEventWrapper to other nodesThis waits for any current transaction to be committed successfully before scheduling the event for publishing.
- Specified by:
publishEventin interfaceClusterManager
-
publishEventImmediately
Description copied from interface:ClusterManagerPublish immediately, an event as a ClusterEventWrapper to other nodesThis is done immediately regardless of the state of any current transactions.
- Specified by:
publishEventImmediatelyin interfaceClusterManager
-
getThisNodeInformation
Description copied from interface:ClusterManagerGet the identity of this node in the cluster. ClusterNodeInformation implements equals().
- Specified by:
getThisNodeInformationin interfaceClusterManager- Returns:
- the identity of this node in the cluster. May return null if the node is not in a cluster.
-
getAllNodesInformation
- Specified by:
getAllNodesInformationin interfaceClusterManager
-
configure
Description copied from interface:ClusterManagerInternalSet a new cluster configuration.- Specified by:
configurein interfaceClusterManagerInternal
-
isConfigured
public boolean isConfigured()- Specified by:
isConfiguredin interfaceClusterManagerInternal- Returns:
- true if
ClusterManagerInternal.configure(ClusterConfig)has been called with a valid configuration, otherwise false.
-
reconfigure
Description copied from interface:ClusterManagerInternalSet a new cluster configuration and cycle the service- Specified by:
reconfigurein interfaceClusterManagerInternal- Throws:
ClusterException
-
stopCluster
@PreDestroy public void stopCluster()Description copied from interface:ClusterManagerInternalStop the clustering service- Specified by:
stopClusterin interfaceClusterManagerInternal
-
startCluster
Description copied from interface:ClusterManagerInternalStart the clustering service- Specified by:
startClusterin interfaceClusterManagerInternal- Throws:
ClusterException
-
getNodeStatusMap
Description copied from interface:ClusterManagerGets status information from all members of the cluster.- Specified by:
getNodeStatusMapin interfaceClusterManager
-
getClusterInvariants
Description copied from interface:ClusterManagerInternalGet 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.- Specified by:
getClusterInvariantsin interfaceClusterManagerInternal- Returns:
- the cluster invariants of this server
- Throws:
ClusterException- if the invariants can not be gathered for some reason
-
getLockForName
- Specified by:
getLockForNamein interfacecom.atlassian.beehive.ClusterLockService
-
submitToKeyOwner
Description copied from interface:ClusterExecutionServiceSubmit a task to be executed by a service given by its name on one node of the cluster that own a given key.- Specified by:
submitToKeyOwnerin interfaceClusterExecutionService- 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
-
submitToNode
public <T> ClusterNodeExecution<T> submitToNode(@Nullable String nodeId, Callable<T> task, String serviceName) throws NoSuchClusterNodeException Description copied from interface:ClusterExecutionServiceSubmit a task to be executed on a node with the specified ID- Specified by:
submitToNodein interfaceClusterExecutionService- 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
-
submitToAllNodes
Description copied from interface:ClusterExecutionServiceSubmit a task to be executed on all nodes in the cluster.- Specified by:
submitToAllNodesin interfaceClusterExecutionService- 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
-
isNodeAuthEnabled
public boolean isNodeAuthEnabled()Get the value of config propertyconfluence.cluster.authentication.enabledfrom confluence.cfg.xml
-