@ParametersAreNonnullByDefault @Internal public class HazelcastClusterManager extends Object implements ClusterManager, com.atlassian.beehive.ClusterLockService, com.google.common.base.Supplier<com.hazelcast.core.HazelcastInstance>, com.atlassian.util.concurrent.Supplier<com.hazelcast.core.HazelcastInstance>, Supplier<com.hazelcast.core.HazelcastInstance>
ClusterManagerDEFAULT_EXECUTOR_SVC_NAME| Constructor and Description |
|---|
HazelcastClusterManager(com.atlassian.config.ApplicationConfig applicationConfig,
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) |
| Modifier and Type | Method and Description |
|---|---|
void |
configure(ClusterConfig clusterConfig)
Set a new cluster configuration.
|
protected com.hazelcast.core.HazelcastInstance |
createHazelcastInstance() |
com.hazelcast.core.HazelcastInstance |
get() |
Collection<ClusterNodeInformation> |
getAllNodesInformation() |
ClusteredLock |
getClusteredLock(String key)
Get a distributed lock -- getting the lock does *not* imply that it has been acquired.
|
ClusterInformation |
getClusterInformation()
Get information about the running cluster.
|
ClusterInvariants |
getClusterInvariants()
Get all attributes of the server that must be consistent between the nodes of a stable cluster.
|
ClusterMembershipCriteria |
getClusterMembershipCriteria()
Get all attributes of the server that must be used as criteria when determining
whether a new node can join this cluster.
|
long |
getClusterUptime()
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 buffer
|
Lock |
getLock(String name)
Get a lock -- getting the lock does *not* imply that it has been acquired.
|
com.atlassian.confluence.cluster.hazelcast.DualLock |
getLockForName(@NonNull String key) |
Map<Integer,NodeStatus> |
getNodeStatuses()
Deprecated.
|
Map<ClusterNodeInformation,NodeStatus> |
getNodeStatusMap()
Gets status information from all members of the cluster.
|
Map<ClusterNodeInformation,CompletionStage<NodeStatus>> |
getNodeStatusMapAsync()
Gets
CompletionStage of status information from all members of the cluster. |
String |
getSharedSecret()
Get the value of config property
confluence.cluster.authentication.secret from confluence.cfg.xml |
ClusterNodeInformation |
getThisNodeInformation()
Get the identity of this node in the cluster.
|
void |
initOutOfmemoryhandler() |
boolean |
isClustered() |
boolean |
isClusterSupported()
Check whether this Confluence distribution is capable of running in a cluster.
|
boolean |
isConfigured() |
boolean |
isNodeAuthEnabled()
Get the value of config property
confluence.cluster.authentication.enabled from confluence.cfg.xml |
void |
publishEvent(ConfluenceEvent event)
Publish an event as a ClusterEventWrapper to other nodes
|
void |
publishEventImmediately(ConfluenceEvent event)
Publish immediately, an event as a ClusterEventWrapper to other nodes
|
void |
reconfigure(ClusterConfig config)
Set a new cluster configuration and cycle the service
|
InetAddress |
resolveName(String name) |
void |
startCluster()
Start the clustering service
|
void |
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.
|
public HazelcastClusterManager(com.atlassian.config.ApplicationConfig applicationConfig,
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)
@PostConstruct public void initOutOfmemoryhandler()
public InetAddress resolveName(String name)
resolveName in interface NameResolverpublic boolean isClusterSupported()
ClusterManagerClusterManager.isClustered() 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.isClusterSupported in interface ClusterManagerpublic long getClusterUptime()
ClusterManagergetClusterUptime in interface ClusterManagerpublic boolean isClustered()
isClustered in interface ClusterManagerpublic ClusterInformation getClusterInformation()
ClusterManagergetClusterInformation in interface ClusterManagerpublic <T> com.atlassian.core.task.FifoBuffer<T> getFifoBuffer(String name)
ClusterManagergetFifoBuffer in interface ClusterManagerpublic void publishEvent(ConfluenceEvent event)
ClusterManagerThis waits for any current transaction to be committed successfully before scheduling the event for publishing.
publishEvent in interface ClusterManagerpublic void publishEventImmediately(ConfluenceEvent event)
ClusterManagerThis is done immediately regardless of the state of any current transactions.
publishEventImmediately in interface ClusterManagerpublic ClusterNodeInformation getThisNodeInformation()
ClusterManagerGet the identity of this node in the cluster. ClusterNodeInformation implements equals().
getThisNodeInformation in interface ClusterManagerpublic Collection<ClusterNodeInformation> getAllNodesInformation()
getAllNodesInformation in interface ClusterManagerpublic void configure(ClusterConfig clusterConfig)
ClusterManagerconfigure in interface ClusterManagerpublic boolean isConfigured()
isConfigured in interface ClusterManagerClusterManager.configure(ClusterConfig) has been called with a
valid configuration, otherwise false.public void reconfigure(ClusterConfig config)
ClusterManagerreconfigure in interface ClusterManager@PreDestroy public void stopCluster()
ClusterManagerstopCluster in interface ClusterManagerpublic void startCluster()
ClusterManagerstartCluster in interface ClusterManagerprotected com.hazelcast.core.HazelcastInstance createHazelcastInstance()
@Deprecated public Map<Integer,NodeStatus> getNodeStatuses()
getNodeStatuses in interface ClusterManagerpublic Map<ClusterNodeInformation,NodeStatus> getNodeStatusMap()
getNodeStatusMap in interface ClusterManagerpublic Map<ClusterNodeInformation,CompletionStage<NodeStatus>> getNodeStatusMapAsync()
CompletionStage of status information from all members of the cluster.getNodeStatusMapAsync in interface ClusterManagerpublic ClusterMembershipCriteria getClusterMembershipCriteria() throws ClusterException
ClusterManagergetClusterMembershipCriteria in interface ClusterManagerClusterException - if the criteria cannot be gathered for some reasonpublic ClusterInvariants getClusterInvariants() throws ClusterException
ClusterManagergetClusterInvariants in interface ClusterManagerClusterException - if the invariants can not be gathered for some reasonpublic com.atlassian.confluence.cluster.hazelcast.DualLock getLockForName(@NonNull String key)
getLockForName in interface com.atlassian.beehive.ClusterLockServicepublic ClusteredLock getClusteredLock(String key)
ClusterManagerLock.tryLock() or Lock.lock() on the returned object to
acquire the lock.getClusteredLock in interface ClusterManagerpublic Lock getLock(String name)
LockFactoryLock.tryLock() or Lock.lock() on the returned object to
acquire the lock.getLock in interface LockFactorypublic com.hazelcast.core.HazelcastInstance get()
public <T> CompletionStage<T> submitToKeyOwner(Callable<T> task, String serviceName, Object key)
ClusterManagersubmitToKeyOwner in interface ClusterManagertask - task to be executed on the node that owns the provided key, it must be SerializableserviceName - name of service used to execute the taskkey - key used to determined which node is going to execute the task, it must be Serializablepublic <T> List<ClusterNodeExecution<T>> submitToAllNodes(Callable<T> task, String serviceName)
ClusterManagersubmitToAllNodes in interface ClusterManagertask - task to be executed on the node that owns the provided key, it must be SerializableserviceName - name of service used to execute the taskClusterNodeExecution, one element from each nodepublic String getSharedSecret()
confluence.cluster.authentication.secret from confluence.cfg.xmlpublic boolean isNodeAuthEnabled()
confluence.cluster.authentication.enabled from confluence.cfg.xmlCopyright © 2003–2022 Atlassian. All rights reserved.