Package com.hazelcast.config.cp
Class CPMapConfig
java.lang.Object
com.hazelcast.config.cp.CPMapConfig
Configuration for
CPMap.- Since:
- 5.4
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThe default maximum size in MB that aCPMapcan total. -
Constructor Summary
ConstructorsConstructorDescriptionDeprecated.exists only for DOM processing.CPMapConfig(CPMapConfig config) Copy constructor.CPMapConfig(String name) Creates a configuration for aCPMapwith the givennameand the default map capacity ofDEFAULT_MAX_SIZE_MB.CPMapConfig(String name, int maxSizeMb) Creates a configuration for aCPMapwith the givennameand maximum capacity in MB as specified bymaxSizeMb. -
Method Summary
Modifier and TypeMethodDescriptionbooleanintGets the maximum capacity in MB.getName()Gets the name of the configuration.inthashCode()booleanReturns whether time-based purging is enabled for this CPMap.setMaxSizeMb(int maxSizeMb) Sets the maximum capacity of theCPMap.Sets the name of the configuration.setPurgeEnabled(boolean purgeEnabled) Enables time-based purging of CPMap entries.toString()
-
Field Details
-
DEFAULT_MAX_SIZE_MB
public static final int DEFAULT_MAX_SIZE_MBThe default maximum size in MB that aCPMapcan total.- See Also:
-
-
Constructor Details
-
CPMapConfig
Deprecated.exists only for DOM processing. -
CPMapConfig
Creates a configuration for aCPMapwith the givennameand the default map capacity ofDEFAULT_MAX_SIZE_MB.- Parameters:
name- of theCPMapthe configuration is applicable for
-
CPMapConfig
Creates a configuration for aCPMapwith the givennameand maximum capacity in MB as specified bymaxSizeMb.DEFAULT_MAX_SIZE_MB. -
CPMapConfig
Copy constructor.- Parameters:
config- to copy
-
-
Method Details
-
getMaxSizeMb
public int getMaxSizeMb()Gets the maximum capacity in MB. -
setMaxSizeMb
Sets the maximum capacity of theCPMap.- Parameters:
maxSizeMb- capacity of theCPMapin MB- Throws:
IllegalArgumentException- ifmaxSizeMbis not positive or exceeds 2000MB
-
setPurgeEnabled
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.7or later. - Licensing: Available only when
ADVANCED_CPis 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.
-
isPurgeEnabled
public boolean isPurgeEnabled()Returns whether time-based purging is enabled for this CPMap.- Returns:
trueif purge is enabled,falseotherwise- See Also:
-
getName
Gets the name of the configuration. -
setName
Sets the name of the configuration.- Throws:
NullPointerException- if thenameis null
-
equals
-
hashCode
public int hashCode() -
toString
-