Package com.atlassian.confluence.cluster
Interface ClusterManager
- All Superinterfaces:
ClusterExecutionService
- All Known Subinterfaces:
ClusterManagerInternal
- All Known Implementing Classes:
HazelcastClusterManager
,NonClusterManager
-
Field Summary
Fields inherited from interface com.atlassian.confluence.cluster.ClusterExecutionService
DEFAULT_EXECUTOR_SVC_NAME
-
Method Summary
Modifier and TypeMethodDescriptionGet information about the running cluster.long
Gets the amount of time that the cluster has been running.Gets status information from all members of the cluster.@Nullable ClusterNodeInformation
Get the identity of this node in the cluster.boolean
void
Releases a permit back to the semaphore with the specified name.boolean
tryAcquire
(@NonNull String name, int initialPermits, long timeout, @NonNull TimeUnit unit) Attempts to acquire a permit from a semaphore with the specified name.Methods inherited from interface com.atlassian.confluence.cluster.ClusterExecutionService
submitToAllNodes, submitToKeyOwner, submitToNode
-
Method Details
-
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. -
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() -
getNodeStatusMap
Map<ClusterNodeInformation,NodeStatus> getNodeStatusMap()Gets status information from all members of the cluster.- Since:
- 5.6
-
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
-
tryAcquire
boolean tryAcquire(@NonNull String name, int initialPermits, long timeout, @NonNull TimeUnit unit) throws InterruptedException Attempts to acquire a permit from a semaphore with the specified name. If the semaphore is not already initialized, it will be initialized with the specified number of initial permits.- Parameters:
name
- the name of the semaphore to acquire a permit from. Must not be null.initialPermits
- the number of permits to initialize the semaphore with if it is not already initialized.timeout
- the maximum time to wait for a permitunit
- the time unit of the timeout argument. Must not be null.- Returns:
- true if a permit was acquired successfully, false if the timeout elapsed before acquiring a permit
- Throws:
NullPointerException
- if the name or unit is nullInterruptedException
-
release
Releases a permit back to the semaphore with the specified name. This increases the number of available permits.- Parameters:
name
- the name of the semaphore to release a permit to. Must not be null.- Throws:
NullPointerException
- if the name is null
-