Class ClusterServiceFactory

    • Constructor Detail

      • ClusterServiceFactory

        public ClusterServiceFactory()
    • Method Detail

      • getNamespace

        public String getNamespace()
        Returns the cluster namespace (see setNamespace(String)).
        Returns:
        Cluster namespace.
      • setNamespace

        public void setNamespace​(String namespace)
        Sets the cluster namespace. Can contain only alpha-numeric characters and non-repeatable dots/hyphens.

        Only those nodes that are configured with the same cluster namespace can form a cluster. Nodes that have different namespaces will form completely independent clusters.

        Default value of this property is "default".

        Hint: For breaking nodes into logical sub-groups within the same cluster consider using node roles with nodes filtering.

        Parameters:
        namespace - Cluster namespace (can contain only alpha-numeric characters and non-repeatable dots/hyphens).
      • setSeedNodeProvider

        public void setSeedNodeProvider​(SeedNodeProvider seedNodeProvider)
        Sets seed node provider that should be used to discover existing cluster nodes when local node starts joining to a cluster.

        By default this property is initialized with MulticastSeedNodeProvider instance. Note that this requires multicasting to be enabled on the target platform.

        Parameters:
        seedNodeProvider - Seed node provider.
        See Also:
        SeedNodeProvider
      • setFailureDetector

        public void setFailureDetector​(FailureDetector failureDetector)
        Sets the failure detector that should be used for health checking of remote nodes.

        By default this property is initialized with a DefaultFailureDetector instance.

        Parameters:
        failureDetector - Failure detector.
        See Also:
        FailureDetector
      • setSplitBrainDetector

        public void setSplitBrainDetector​(SplitBrainDetector splitBrainDetector)
        Sets the cluster split-brain detector.

        Split-brain can happen if other cluster members decided that this node is not reachable (due to some networking problems or long GC pauses). In such case they will remove this node from their topology while this node will think that it is still a member of the cluster. This component is responsible for checking if local node is reachable by other cluster nodes.

        If this component detects that local node is not reachable then HekateFatalErrorPolicy will be applied to the local node with ClusterSplitBrainException as a cause.

        Parameters:
        splitBrainDetector - Cluster split-brain detector.
      • getSplitBrainCheckInterval

        public long getSplitBrainCheckInterval()
        Returns the time interval in milliseconds for split-brain checking (see setSplitBrainCheckInterval(long)).
        Returns:
        Time interval in milliseconds.
      • setSplitBrainCheckInterval

        public void setSplitBrainCheckInterval​(long splitBrainCheckInterval)
        Sets the time interval in milliseconds for split-brain checking.

        If the specified value is greater than zero then once per such interval the SplitBrainDetector component will be called to check the node's health.

        Default value of this parameter is 0 (i.e. periodic checks are disabled by default).

        Parameters:
        splitBrainCheckInterval - Time interval in milliseconds.
      • withSplitBrainCheckInterval

        public ClusterServiceFactory withSplitBrainCheckInterval​(long splitBrainCheckInterval)
        Fluent-style version of setSplitBrainCheckInterval(long).
        Parameters:
        splitBrainCheckInterval - Time interval in milliseconds.
        Returns:
        This instance.
      • setClusterListeners

        public void setClusterListeners​(List<ClusterEventListener> clusterListeners)
        Sets a list of cluster event listeners to be notified upon ClusterEvent.
        Parameters:
        clusterListeners - Cluster event listeners.
      • setAcceptors

        public void setAcceptors​(List<ClusterAcceptor> acceptors)
        Sets the list of the cluster join acceptors.

        Cluster join acceptors are responsible for implementing a custom logic of accepting/rejecting new nodes based on some application-specific criteria (f.e. configuration compatibility, authorization, etc). For more details please see the documentation of the ClusterAcceptor interface.

        Parameters:
        acceptors - List of cluster join acceptors.
        See Also:
        ClusterAcceptor
      • getGossipInterval

        public long getGossipInterval()
        Returns the time interval in millisecond between gossip rounds (see setGossipInterval(long)).
        Returns:
        The time interval in millisecond between gossip rounds.
      • setGossipInterval

        public void setGossipInterval​(long gossipInterval)
        Sets the time interval in milliseconds between gossip rounds.

        During each round the local node will exchange its topology view with a set of randomly selected remote nodes in order to make sure that topology view is consistent across the whole cluster.

        Value of this parameter must be greater than zero.

        Default value of this parameter is 1000L.

        Parameters:
        gossipInterval - The time interval in milliseconds between gossip rounds.
      • withGossipInterval

        public ClusterServiceFactory withGossipInterval​(long gossipInterval)
        Fluent-style version of setGossipInterval(long).
        Parameters:
        gossipInterval - The time interval in milliseconds between gossip rounds.
        Returns:
        This instance.
      • getSpeedUpGossipSize

        public int getSpeedUpGossipSize()
        Returns the maximum amount of nodes in the cluster for the gossip protocol to speeded up by sending messages at a higher rate so that the cluster could converge faster (see setSpeedUpGossipSize(int)).
        Returns:
        The maximum amount of nodes in the cluster when gossip protocol can be speeded up.
      • setSpeedUpGossipSize

        public void setSpeedUpGossipSize​(int speedUpGossipSize)
        Sets the maximum amount of nodes in the cluster for the gossip protocol to speed up by sending messages at a higher rate so that the cluster could converge faster.

        If this parameter is set to a positive value and the current cluster size is less than the specified value then local node will send gossip messages at higher rate in order to speed-up cluster convergence. However this can highly increase resources utilization and should be used in a cluster of relatively small size.

        Default value of this parameter is 100.

        Parameters:
        speedUpGossipSize - The maximum amount of nodes in the cluster when gossip protocol can be speeded up.
      • withSpeedUpGossipSize

        public ClusterServiceFactory withSpeedUpGossipSize​(int speedUpSize)
        Fluent-style version of setSpeedUpGossipSize(int).
        Parameters:
        speedUpSize - The maximum amount of nodes in the cluster when gossip protocol can be speeded up.
        Returns:
        This instance.