Interface ClusterManager

    • 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 from 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.
        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 Use ClusterLockService.getLockForName(String) instead.
        Get a distributed lock -- getting the lock does *not* imply that it has been acquired. Call Lock.tryLock() or Lock.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 nodes

        This 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 nodes

        This 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.
      • 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
      • getClusterMembershipCriteria

        @Deprecated
        ClusterMembershipCriteria getClusterMembershipCriteria()
                                                        throws ClusterException
        Deprecated.
        since 7.13. Use getClusterInvariants() 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 be Serializable
        serviceName - name of service used to execute the task
        key - key used to determined which node is going to execute the task, it must be Serializable
        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 node
        serviceName - 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 be Serializable
        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