Class MergePolicyConfig

java.lang.Object
com.hazelcast.config.MergePolicyConfig
All Implemented Interfaces:
DataSerializable, IdentifiedDataSerializable

public class MergePolicyConfig
extends Object
implements IdentifiedDataSerializable
Configuration for SplitBrainMergePolicy.
  • Field Details

    • DEFAULT_MERGE_POLICY

      public static final String DEFAULT_MERGE_POLICY
      Default merge policy.
    • DEFAULT_BATCH_SIZE

      public static final int DEFAULT_BATCH_SIZE
      Default batch size.
      See Also:
      Constant Field Values
  • Constructor Details

    • MergePolicyConfig

      public MergePolicyConfig()
    • MergePolicyConfig

      public MergePolicyConfig​(String policy, int batchSize)
    • MergePolicyConfig

      public MergePolicyConfig​(MergePolicyConfig mergePolicyConfig)
  • Method Details

    • getPolicy

      public String getPolicy()
      Returns the classname of the SplitBrainMergePolicy.
      Returns:
      the classname of the merge policy
    • setPolicy

      public MergePolicyConfig setPolicy​(String policy)
      Sets the classname of your SplitBrainMergePolicy.

      For the out-of-the-box merge policies the simple classname is sufficient, e.g. PutIfAbsentMergePolicy. But also the fully qualified classname is fine, e.g. com.hazelcast.spi.merge.PutIfAbsentMergePolicy. For a custom merge policy the fully qualified classname is needed.

      Must be a non-empty string. The default value is PutIfAbsentMergePolicy.

      Parameters:
      policy - the classname of the merge policy
      Returns:
      this MergePolicyConfig instance
    • getBatchSize

      public int getBatchSize()
      Returns the batch size, which will be used to determine the number of entries to be sent in a merge operation.
      Returns:
      the batch size
    • setBatchSize

      public MergePolicyConfig setBatchSize​(int batchSize)
      Sets the batch size, which will be used to determine the number of entries to be sent in a merge operation.

      Must be a positive number. Set to 1 to disable batching. The default value is 100.

      Parameters:
      batchSize - the batch size
      Returns:
      this MergePolicyConfig instance
    • getFactoryId

      public int getFactoryId()
      Description copied from interface: IdentifiedDataSerializable
      Returns DataSerializableFactory factory ID for this class.
      Specified by:
      getFactoryId in interface IdentifiedDataSerializable
      Returns:
      factory ID
    • getClassId

      public int getClassId()
      Description copied from interface: IdentifiedDataSerializable
      Returns type identifier for this class. It should be unique per DataSerializableFactory.
      Specified by:
      getClassId in interface IdentifiedDataSerializable
      Returns:
      type ID
    • writeData

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

      public final boolean equals​(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public final int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object