public class MapConfig extends Object implements SplitBrainMergeTypeProvider, IdentifiedDataSerializable, Versioned, NamedConfig
IMap
.Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_BACKUP_COUNT
The default number of backups
|
static CacheDeserializedValues |
DEFAULT_CACHED_DESERIALIZED_VALUES
We want to cache values only when an index is defined.
|
static int |
DEFAULT_EVICTION_PERCENTAGE
The number of default eviction percentage
|
static EvictionPolicy |
DEFAULT_EVICTION_POLICY
Default policy for eviction.
|
static InMemoryFormat |
DEFAULT_IN_MEMORY_FORMAT
Default In-Memory format is binary.
|
static String |
DEFAULT_MAP_MERGE_POLICY
Default policy for merging.
|
static int |
DEFAULT_MAX_IDLE_SECONDS
The number of default time to wait eviction in seconds.
|
static MetadataPolicy |
DEFAULT_METADATA_POLICY
Default metadata policy
|
static long |
DEFAULT_MIN_EVICTION_CHECK_MILLIS
Minimum time in milliseconds which should pass before asking
if a partition of this map is evictable or not.
|
static int |
DEFAULT_TTL_SECONDS
The number of default Time to Live in seconds.
|
static int |
MAX_BACKUP_COUNT
The maximum number of backups
|
static int |
MAX_EVICTION_PERCENTAGE
The number of maximum eviction percentage
|
static int |
MIN_BACKUP_COUNT
The minimum number of backups
|
static int |
MIN_EVICTION_PERCENTAGE
The number of minimum eviction percentage
|
Constructor and Description |
---|
MapConfig() |
MapConfig(MapConfig config) |
MapConfig(String name) |
Modifier and Type | Method and Description |
---|---|
MapConfig |
addEntryListenerConfig(EntryListenerConfig listenerConfig) |
MapConfig |
addMapAttributeConfig(MapAttributeConfig mapAttributeConfig) |
MapConfig |
addMapIndexConfig(MapIndexConfig mapIndexConfig) |
MapConfig |
addMapPartitionLostListenerConfig(MapPartitionLostListenerConfig listenerConfig) |
MapConfig |
addQueryCacheConfig(QueryCacheConfig queryCacheConfig)
Adds a new
QueryCacheConfig to this MapConfig . |
boolean |
equals(Object o) |
MapConfigReadOnly |
getAsReadOnly()
Deprecated.
this method will be removed in 4.0; it is meant for internal usage only
|
int |
getAsyncBackupCount()
Returns the asynchronous backup count for this
IMap . |
int |
getBackupCount()
Returns the backupCount for this
IMap |
CacheDeserializedValues |
getCacheDeserializedValues()
Get current value cache settings
|
List<EntryListenerConfig> |
getEntryListenerConfigs() |
int |
getEvictionPercentage()
Deprecated.
As of version 3.7, eviction mechanism changed.
It uses a probabilistic algorithm based on sampling. Please see documentation for further details.
|
EvictionPolicy |
getEvictionPolicy()
Returns the
EvictionPolicy . |
int |
getFactoryId()
Returns DataSerializableFactory factory ID for this class.
|
HotRestartConfig |
getHotRestartConfig()
Gets the
HotRestartConfig for this MapConfig |
int |
getId()
Returns type identifier for this class.
|
InMemoryFormat |
getInMemoryFormat()
Returns the data type that will be used for storing records.
|
List<MapAttributeConfig> |
getMapAttributeConfigs() |
MapEvictionPolicy |
getMapEvictionPolicy()
Returns custom eviction policy if it is set otherwise returns
null . |
List<MapIndexConfig> |
getMapIndexConfigs() |
MapStoreConfig |
getMapStoreConfig()
Returns the map store configuration
|
int |
getMaxIdleSeconds()
Returns the maximum number of seconds for each entry to stay idle in the map.
|
MaxSizeConfig |
getMaxSizeConfig() |
String |
getMergePolicy()
Deprecated.
since 3.10, please use
getMergePolicyConfig() and MergePolicyConfig.getPolicy() |
MergePolicyConfig |
getMergePolicyConfig()
Gets the
MergePolicyConfig for this map. |
MetadataPolicy |
getMetadataPolicy()
Returns
MetadataPolicy for this map. |
long |
getMinEvictionCheckMillis()
Deprecated.
As of version 3.7, eviction mechanism changed.
It uses a probabilistic algorithm based on sampling. Please see documentation for further details.
|
String |
getName()
Returns the name of this
IMap |
NearCacheConfig |
getNearCacheConfig()
Returns the Near Cache configuration
|
PartitioningStrategyConfig |
getPartitioningStrategyConfig() |
List<MapPartitionLostListenerConfig> |
getPartitionLostListenerConfigs() |
Class |
getProvidedMergeTypes() |
List<QueryCacheConfig> |
getQueryCacheConfigs()
Returns all
QueryCacheConfig instances defined on this MapConfig . |
String |
getQuorumName() |
int |
getTimeToLiveSeconds()
Returns the maximum number of seconds for each entry to stay in the map.
|
int |
getTotalBackupCount()
Returns the total number of backups: backupCount plus asyncBackupCount.
|
WanReplicationRef |
getWanReplicationRef()
Gets the WAN target replication reference.
|
int |
hashCode() |
boolean |
isNearCacheEnabled()
Checks if Near Cache is enabled.
|
boolean |
isOptimizeQueries()
Deprecated.
use
getQueryCacheConfigs() instead |
boolean |
isReadBackupData()
Checks if read-backup-data (reading local backup entries) is enabled for this map.
|
boolean |
isStatisticsEnabled()
Checks if statistics are enabled for this map.
|
void |
readData(ObjectDataInput in)
Reads fields from the input stream
|
MapConfig |
setAsyncBackupCount(int asyncBackupCount)
Sets the number of asynchronous backups.
|
MapConfig |
setBackupCount(int backupCount)
Number of synchronous backups.
|
MapConfig |
setCacheDeserializedValues(CacheDeserializedValues cacheDeserializedValues)
Configure de-serialized value caching.
|
MapConfig |
setEntryListenerConfigs(List<EntryListenerConfig> listenerConfigs) |
MapConfig |
setEvictionPercentage(int evictionPercentage)
Deprecated.
As of version 3.7, eviction mechanism changed.
It uses a probabilistic algorithm based on sampling. Please see documentation for further details
|
MapConfig |
setEvictionPolicy(EvictionPolicy evictionPolicy)
Sets the
EvictionPolicy . |
MapConfig |
setHotRestartConfig(HotRestartConfig hotRestartConfig)
Sets the
HotRestartConfig for this MapConfig |
MapConfig |
setInMemoryFormat(InMemoryFormat inMemoryFormat)
Binary type that will be used for storing records.
|
MapConfig |
setMapAttributeConfigs(List<MapAttributeConfig> mapAttributeConfigs) |
MapConfig |
setMapEvictionPolicy(MapEvictionPolicy mapEvictionPolicy)
Sets custom eviction policy implementation for this map.
|
MapConfig |
setMapIndexConfigs(List<MapIndexConfig> mapIndexConfigs) |
MapConfig |
setMapStoreConfig(MapStoreConfig mapStoreConfig)
Sets the map store configuration
|
MapConfig |
setMaxIdleSeconds(int maxIdleSeconds)
Maximum number of seconds for each entry to stay idle in the map.
|
MapConfig |
setMaxSizeConfig(MaxSizeConfig maxSizeConfig) |
MapConfig |
setMergePolicy(String mergePolicy)
Deprecated.
since 3.10, please use
setMergePolicyConfig(MergePolicyConfig) |
MapConfig |
setMergePolicyConfig(MergePolicyConfig mergePolicyConfig)
Sets the
MergePolicyConfig for this map. |
MapConfig |
setMetadataPolicy(MetadataPolicy metadataPolicy)
Sets the metadata policy.
|
MapConfig |
setMinEvictionCheckMillis(long minEvictionCheckMillis)
Deprecated.
As of version 3.7, eviction mechanism changed.
It uses a probabilistic algorithm based on sampling. Please see documentation for further details.
|
MapConfig |
setName(String name)
Sets the name of the
IMap |
MapConfig |
setNearCacheConfig(NearCacheConfig nearCacheConfig)
Sets the Near Cache configuration
|
MapConfig |
setOptimizeQueries(boolean optimizeQueries)
Deprecated.
|
MapConfig |
setPartitioningStrategyConfig(PartitioningStrategyConfig partitioningStrategyConfig) |
MapConfig |
setPartitionLostListenerConfigs(List<MapPartitionLostListenerConfig> listenerConfigs) |
void |
setQueryCacheConfigs(List<QueryCacheConfig> queryCacheConfigs)
Sets
QueryCacheConfig instances to this MapConfig . |
MapConfig |
setQuorumName(String quorumName) |
MapConfig |
setReadBackupData(boolean readBackupData)
Sets read-backup-data (reading local backup entries) for this map.
|
MapConfig |
setStatisticsEnabled(boolean statisticsEnabled)
Sets statistics to enabled or disabled for this map.
|
MapConfig |
setTimeToLiveSeconds(int timeToLiveSeconds)
The maximum number of seconds for each entry to stay in the map.
|
MapConfig |
setWanReplicationRef(WanReplicationRef wanReplicationRef)
Sets the WAN target replication reference.
|
String |
toString() |
void |
writeData(ObjectDataOutput out)
Writes object fields to output stream
|
public static final int MIN_BACKUP_COUNT
public static final int DEFAULT_BACKUP_COUNT
public static final int MAX_BACKUP_COUNT
public static final int MIN_EVICTION_PERCENTAGE
public static final int DEFAULT_EVICTION_PERCENTAGE
public static final int MAX_EVICTION_PERCENTAGE
public static final long DEFAULT_MIN_EVICTION_CHECK_MILLIS
public static final int DEFAULT_TTL_SECONDS
public static final int DEFAULT_MAX_IDLE_SECONDS
public static final EvictionPolicy DEFAULT_EVICTION_POLICY
public static final String DEFAULT_MAP_MERGE_POLICY
public static final InMemoryFormat DEFAULT_IN_MEMORY_FORMAT
public static final CacheDeserializedValues DEFAULT_CACHED_DESERIALIZED_VALUES
public static final MetadataPolicy DEFAULT_METADATA_POLICY
public MapConfig()
public MapConfig(String name)
public MapConfig(MapConfig config)
public MapConfigReadOnly getAsReadOnly()
public String getName()
IMap
getName
in interface NamedConfig
IMap
public MapConfig setName(String name)
IMap
setName
in interface NamedConfig
name
- the name to set for this IMap
public InMemoryFormat getInMemoryFormat()
public MapConfig setInMemoryFormat(InMemoryFormat inMemoryFormat)
inMemoryFormat
- the record type to set for this IMap
IllegalArgumentException
- if inMemoryFormat is null
public int getBackupCount()
IMap
IMap
getAsyncBackupCount()
public MapConfig setBackupCount(int backupCount)
backupCount
- the number of synchronous backups to set for this IMap
setAsyncBackupCount(int)
public int getAsyncBackupCount()
IMap
.setBackupCount(int)
public MapConfig setAsyncBackupCount(int asyncBackupCount)
asyncBackupCount
- the number of asynchronous synchronous backups to setIllegalArgumentException
- if asyncBackupCount smaller than 0,
or larger than the maximum number of backup
or the sum of the backups and async backups is larger than the maximum number of backupssetBackupCount(int)
,
getAsyncBackupCount()
public int getTotalBackupCount()
@Deprecated public int getEvictionPercentage()
public MapConfig setEvictionPercentage(int evictionPercentage)
Beware that eviction mechanism is different for NATIVE in-memory format (It uses a probabilistic algorithm based on sampling. Please see documentation for further details) and this parameter has no effect.
evictionPercentage
- the evictionPercentage to set: the specified percentage of the map to be evictedIllegalArgumentException
- if evictionPercentage is not in the 0-100 rangepublic long getMinEvictionCheckMillis()
Default value is 100L milliseconds.
public MapConfig setMinEvictionCheckMillis(long minEvictionCheckMillis)
Default value is 100L milliseconds.
Beware that eviction mechanism is different for NATIVE in-memory format (It uses a probabilistic algorithm based on sampling. Please see documentation for further details) and this parameter has no effect.
minEvictionCheckMillis
- time in milliseconds that should pass before asking for the next evictionpublic int getTimeToLiveSeconds()
public MapConfig setTimeToLiveSeconds(int timeToLiveSeconds)
timeToLiveSeconds
- the timeToLiveSeconds to setpublic int getMaxIdleSeconds()
public MapConfig setMaxIdleSeconds(int maxIdleSeconds)
maxIdleSeconds
will get automatically evicted from the map.
Entry is touched if get()
, getAll()
, put()
or containsKey()
is called.
Any integer between 0
and Integer.MAX_VALUE
.
0
means infinite. Default is 0
.maxIdleSeconds
- the maxIdleSeconds (the maximum number of seconds for each entry to stay idle in the map) to setpublic MaxSizeConfig getMaxSizeConfig()
public MapConfig setMaxSizeConfig(MaxSizeConfig maxSizeConfig)
public EvictionPolicy getEvictionPolicy()
EvictionPolicy
.public MapConfig setEvictionPolicy(EvictionPolicy evictionPolicy)
EvictionPolicy
. Default value is EvictionPolicy.NONE
.evictionPolicy
- the evictionPolicy to setpublic MapEvictionPolicy getMapEvictionPolicy()
null
.null
public MapConfig setMapEvictionPolicy(MapEvictionPolicy mapEvictionPolicy)
Internal eviction algorithm finds most appropriate entry to evict from this map by using supplied policy.
mapEvictionPolicy
- custom eviction policy implementationpublic MapStoreConfig getMapStoreConfig()
public MapConfig setMapStoreConfig(MapStoreConfig mapStoreConfig)
mapStoreConfig
- the mapStoreConfig (map store configuration) to setpublic NearCacheConfig getNearCacheConfig()
public MapConfig setNearCacheConfig(NearCacheConfig nearCacheConfig)
nearCacheConfig
- the Near Cache configurationpublic String getMergePolicy()
getMergePolicyConfig()
and MergePolicyConfig.getPolicy()
public MapConfig setMergePolicy(String mergePolicy)
setMergePolicyConfig(MergePolicyConfig)
Accepts a classname of SplitBrainMergePolicy
or the deprecated MapMergePolicy
.
mergePolicy
- the merge policy classname to setpublic MergePolicyConfig getMergePolicyConfig()
MergePolicyConfig
for this map.MergePolicyConfig
for this mappublic MapConfig setMergePolicyConfig(MergePolicyConfig mergePolicyConfig)
MergePolicyConfig
for this map.public Class getProvidedMergeTypes()
getProvidedMergeTypes
in interface SplitBrainMergeTypeProvider
public boolean isStatisticsEnabled()
true
if statistics are enabled, false
otherwisepublic MapConfig setStatisticsEnabled(boolean statisticsEnabled)
statisticsEnabled
- true
to enable map statistics, false
to disablepublic boolean isReadBackupData()
true
if read-backup-data is enabled, false
otherwisepublic MapConfig setReadBackupData(boolean readBackupData)
readBackupData
- true
to enable read-backup-data, false
to disablepublic WanReplicationRef getWanReplicationRef()
public MapConfig setWanReplicationRef(WanReplicationRef wanReplicationRef)
wanReplicationRef
- the WAN target replication referencepublic MapConfig addEntryListenerConfig(EntryListenerConfig listenerConfig)
public List<EntryListenerConfig> getEntryListenerConfigs()
public MapConfig setEntryListenerConfigs(List<EntryListenerConfig> listenerConfigs)
public MapConfig addMapPartitionLostListenerConfig(MapPartitionLostListenerConfig listenerConfig)
public List<MapPartitionLostListenerConfig> getPartitionLostListenerConfigs()
public MapConfig setPartitionLostListenerConfigs(List<MapPartitionLostListenerConfig> listenerConfigs)
public MapConfig addMapIndexConfig(MapIndexConfig mapIndexConfig)
public List<MapIndexConfig> getMapIndexConfigs()
public MapConfig setMapIndexConfigs(List<MapIndexConfig> mapIndexConfigs)
public MapConfig addMapAttributeConfig(MapAttributeConfig mapAttributeConfig)
public List<MapAttributeConfig> getMapAttributeConfigs()
public MapConfig setMapAttributeConfigs(List<MapAttributeConfig> mapAttributeConfigs)
public MetadataPolicy getMetadataPolicy()
MetadataPolicy
for this map.MetadataPolicy
for this mappublic MapConfig setMetadataPolicy(MetadataPolicy metadataPolicy)
MetadataPolicy
for more
information.metadataPolicy
- public MapConfig addQueryCacheConfig(QueryCacheConfig queryCacheConfig)
QueryCacheConfig
to this MapConfig
.queryCacheConfig
- the config to be addedMapConfig
instanceIllegalArgumentException
- if there is already a QueryCache
with the same QueryCacheConfig#name
public List<QueryCacheConfig> getQueryCacheConfigs()
QueryCacheConfig
instances defined on this MapConfig
.QueryCacheConfig
instances defined on this MapConfig
public void setQueryCacheConfigs(List<QueryCacheConfig> queryCacheConfigs)
QueryCacheConfig
instances to this MapConfig
.public PartitioningStrategyConfig getPartitioningStrategyConfig()
public MapConfig setPartitioningStrategyConfig(PartitioningStrategyConfig partitioningStrategyConfig)
public boolean isNearCacheEnabled()
true
if Near Cache is enabled, false
otherwisepublic boolean isOptimizeQueries()
getQueryCacheConfigs()
insteadtrue
if queries are optimized, false
otherwisepublic MapConfig setOptimizeQueries(boolean optimizeQueries)
setCacheDeserializedValues(CacheDeserializedValues)
insteadInMemoryFormat
is InMemoryFormat.OBJECT
or when Portable
serialization is used.optimizeQueries
- true
if queries should be optimized, false
otherwiseMapConfig
instanceCacheDeserializedValues
public MapConfig setCacheDeserializedValues(CacheDeserializedValues cacheDeserializedValues)
CacheDeserializedValues.INDEX_ONLY
MapConfig
instanceCacheDeserializedValues
public HotRestartConfig getHotRestartConfig()
HotRestartConfig
for this MapConfig
public MapConfig setHotRestartConfig(HotRestartConfig hotRestartConfig)
HotRestartConfig
for this MapConfig
hotRestartConfig
- hot restart configMapConfig
instancepublic CacheDeserializedValues getCacheDeserializedValues()
public String getQuorumName()
public int getFactoryId()
IdentifiedDataSerializable
getFactoryId
in interface IdentifiedDataSerializable
public int getId()
IdentifiedDataSerializable
getId
in interface IdentifiedDataSerializable
public void writeData(ObjectDataOutput out) throws IOException
DataSerializable
writeData
in interface DataSerializable
out
- outputIOException
- if an I/O error occurs. In particular,
an IOException
may be thrown if the
output stream has been closed.public void readData(ObjectDataInput in) throws IOException
DataSerializable
readData
in interface DataSerializable
in
- inputIOException
- if an I/O error occurs. In particular,
an IOException
may be thrown if the
input stream has been closed.Copyright © 2019 Hazelcast, Inc.. All Rights Reserved.