Class SplitBrainProtectionConfig

  • All Implemented Interfaces:
    NamedConfig, DataSerializable, IdentifiedDataSerializable

    public class SplitBrainProtectionConfig
    extends java.lang.Object
    implements IdentifiedDataSerializable, NamedConfig
    Configuration for cluster split brain protection, a means to protect consistency of data from network partitions. In this context, split brain protection refers to the number of members in the cluster required for an operation to succeed.

    Since Hazelcast 3.5, the default built-in split brain protection implementation keeps track of the number of members in the cluster, as determined by Hazelcast's cluster membership management.

    Since Hazelcast 3.10, two additional built-in split brain protection implementations, decoupled from the existing cluster membership management, are provided:

    • Probabilistic split brain protection: in this mode, member heartbeats are tracked and an adaptive failure detector determines for each member the suspicion level. Additionally, when the Hazelcast member is configured with the ICMP ping failure detector enabled and operating in parallel mode, ping information is also used to detect member failures early.

      To create a SplitBrainProtectionConfig for probabilistic split brain protection, use newProbabilisticSplitBrainProtectionConfigBuilder(String, int) to configure and build the SplitBrainProtectionConfig.

    • Recently-active split brain protection: in this mode, for a member to be considered present for split brain protection, a heartbeat must be received within the configured time-window since now. Additionally, when the Hazelcast member is configured with the ICMP ping failure detector enabled and operating in parallel mode, ping information is also used to detect member failures early.

      To create a SplitBrainProtectionConfig for recently-active split brain protection, use newRecentlyActiveSplitBrainProtectionConfigBuilder(String, int, int) to configure and build the SplitBrainProtectionConfig.

    See Also:
    SplitBrainProtectionFunction, ProbabilisticSplitBrainProtectionFunction, RecentlyActiveSplitBrainProtectionFunction
    • Constructor Detail

      • SplitBrainProtectionConfig

        public SplitBrainProtectionConfig()
      • SplitBrainProtectionConfig

        public SplitBrainProtectionConfig​(java.lang.String name)
      • SplitBrainProtectionConfig

        public SplitBrainProtectionConfig​(java.lang.String name,
                                          boolean enabled)
      • SplitBrainProtectionConfig

        public SplitBrainProtectionConfig​(java.lang.String name,
                                          boolean enabled,
                                          int minimumClusterSize)
    • Method Detail

      • getName

        public java.lang.String getName()
        Specified by:
        getName in interface NamedConfig
      • isEnabled

        public boolean isEnabled()
      • getMinimumClusterSize

        public int getMinimumClusterSize()
      • getFunctionClassName

        public java.lang.String getFunctionClassName()
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • writeData

        public void writeData​(ObjectDataOutput out)
                       throws java.io.IOException
        Description copied from interface: DataSerializable
        Writes object fields to output stream
        Specified by:
        writeData in interface DataSerializable
        Parameters:
        out - output
        Throws:
        java.io.IOException - if an I/O error occurs. In particular, an IOException may be thrown if the output stream has been closed.
      • readData

        public void readData​(ObjectDataInput in)
                      throws java.io.IOException
        Description copied from interface: DataSerializable
        Reads fields from the input stream
        Specified by:
        readData in interface DataSerializable
        Parameters:
        in - input
        Throws:
        java.io.IOException - if an I/O error occurs. In particular, an IOException may be thrown if the input stream has been closed.
      • newProbabilisticSplitBrainProtectionConfigBuilder

        public static ProbabilisticSplitBrainProtectionConfigBuilder newProbabilisticSplitBrainProtectionConfigBuilder​(java.lang.String name,
                                                                                                                       int minimumClusterSize)
        Returns a builder for SplitBrainProtectionConfig with the given name using a probabilistic split brain protection function, for the given split brain protection size that is enabled by default.
        Parameters:
        name - the split brain protection's name
        minimumClusterSize - minimum count of members in the cluster not to be considered it split.
        See Also:
        ProbabilisticSplitBrainProtectionFunction
      • newRecentlyActiveSplitBrainProtectionConfigBuilder

        public static RecentlyActiveSplitBrainProtectionConfigBuilder newRecentlyActiveSplitBrainProtectionConfigBuilder​(java.lang.String name,
                                                                                                                         int minimumClusterSize,
                                                                                                                         int toleranceMillis)
        Returns a builder for a SplitBrainProtectionConfig with the given name using a recently-active split brain protection function for the given split brain protection size that is enabled by default.
        Parameters:
        name - the split brain protection's name
        minimumClusterSize - minimum count of members in the cluster not to be considered it split.
        toleranceMillis - maximum amount of milliseconds that may have passed since last heartbeat was received for a member to be considered present for split brain protection.
        See Also:
        RecentlyActiveSplitBrainProtectionFunction
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object