Class CPMapConfig

java.lang.Object
com.hazelcast.config.cp.CPMapConfig

public class CPMapConfig extends Object
Configuration for CPMap.
Since:
5.4
  • Field Details

    • DEFAULT_MAX_SIZE_MB

      public static final int DEFAULT_MAX_SIZE_MB
      The default maximum size in MB that a CPMap can total.
      See Also:
  • Constructor Details

    • CPMapConfig

      @Deprecated public CPMapConfig()
      Deprecated.
      exists only for DOM processing.
    • CPMapConfig

      public CPMapConfig(String name)
      Creates a configuration for a CPMap with the given name and the default map capacity of DEFAULT_MAX_SIZE_MB.
      Parameters:
      name - of the CPMap the configuration is applicable for
    • CPMapConfig

      public CPMapConfig(String name, int maxSizeMb)
      Creates a configuration for a CPMap with the given name and maximum capacity in MB as specified by maxSizeMb. DEFAULT_MAX_SIZE_MB.
      Parameters:
      name - of the CPMap the configuration is applicable for
      maxSizeMb - maximum MB capacity of the CPMap
    • CPMapConfig

      public CPMapConfig(CPMapConfig config)
      Copy constructor.
      Parameters:
      config - to copy
  • Method Details

    • getMaxSizeMb

      public int getMaxSizeMb()
      Gets the maximum capacity in MB.
    • setMaxSizeMb

      public CPMapConfig setMaxSizeMb(int maxSizeMb)
      Sets the maximum capacity of the CPMap.
      Parameters:
      maxSizeMb - capacity of the CPMap in MB
      Throws:
      IllegalArgumentException - if maxSizeMb is not positive or exceeds 2000MB
    • setPurgeEnabled

      public CPMapConfig setPurgeEnabled(boolean purgeEnabled)
      Enables time-based purging of CPMap entries.

      When enabled, entries exceeding a given age may be removed based on logical timestamps assigned by the current Raft leader at write or update time, rather than local clocks of follower nodes. Default is false.

      Requirements and Constraints

      • Fresh maps only: Purge must be enabled at map creation time. Changing this setting on an existing CPMap results in undefined behavior.
      • Minimum cluster version: Requires cluster version 5.7 or later.
      • Licensing: Available only when ADVANCED_CP is enabled.

      Caveats

      • Purge execution may introduce latency proportional to the number of entries and can temporarily affect other cluster operations.
      • Purge is triggered explicitly via CPDataStructureManagementService.purgeCPMap(java.lang.String, java.time.Duration).
      • Using a monotonic clock is recommended to preserve logical correctness across leader changes. Clock drift does not affect safety but may cause entries to become eligible earlier or later than expected.
      See Also:
    • isPurgeEnabled

      public boolean isPurgeEnabled()
      Returns whether time-based purging is enabled for this CPMap.
      Returns:
      true if purge is enabled, false otherwise
      See Also:
    • getName

      @Nullable public String getName()
      Gets the name of the configuration.
    • setName

      public CPMapConfig setName(String name)
      Sets the name of the configuration.
      Throws:
      NullPointerException - if the name is null
    • equals

      public boolean equals(Object object)
      Overrides:
      equals in class Object
    • hashCode

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

      public String toString()
      Overrides:
      toString in class Object