Package com.hazelcast.config
Class MapStoreConfig
- java.lang.Object
-
- com.hazelcast.config.MapStoreConfig
-
- All Implemented Interfaces:
DataSerializable
,IdentifiedDataSerializable
,com.hazelcast.nio.serialization.impl.Versioned
public class MapStoreConfig extends java.lang.Object implements IdentifiedDataSerializable, com.hazelcast.nio.serialization.impl.Versioned
Contains the configuration for a Map Store.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
MapStoreConfig.InitialLoadMode
Initial load module
-
Field Summary
Fields Modifier and Type Field Description static boolean
DEFAULT_OFFLOAD
Default offload behaviorstatic int
DEFAULT_WRITE_BATCH_SIZE
Default batch size for writingstatic boolean
DEFAULT_WRITE_COALESCING
Default write coalescing behaviorstatic int
DEFAULT_WRITE_DELAY_SECONDS
Default delay seconds for writing
-
Constructor Summary
Constructors Constructor Description MapStoreConfig()
MapStoreConfig(MapStoreConfig config)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object o)
int
getClassId()
Returns type identifier for this class.java.lang.String
getClassName()
Returns the name of the MapStore implementation classjava.lang.String
getFactoryClassName()
Returns the name of the MapStoreFactory implementation classint
getFactoryId()
Returns DataSerializableFactory factory ID for this class.java.lang.Object
getFactoryImplementation()
Returns the map store factory implementation object.java.lang.Object
getImplementation()
Returns the map store implementation object.MapStoreConfig.InitialLoadMode
getInitialLoadMode()
Returns the initial load mode.java.util.Properties
getProperties()
Returns all the propertiesjava.lang.String
getProperty(java.lang.String name)
Returns the given propertyint
getWriteBatchSize()
Returns the number of operations to be included in each batch processing round.int
getWriteDelaySeconds()
Returns the number of seconds to delay the store writes.int
hashCode()
boolean
isEnabled()
Returns if this configuration is enabledboolean
isOffload()
Default value is true.boolean
isWriteCoalescing()
Returnstrue
if write-coalescing is enabled.void
readData(ObjectDataInput in)
Reads fields from the input streamMapStoreConfig
setClassName(java.lang.String className)
Sets the name for the MapStore implementation classMapStoreConfig
setEnabled(boolean enabled)
Enables and disables this configurationMapStoreConfig
setFactoryClassName(java.lang.String factoryClassName)
Sets the name for the MapStoreFactory implementation classMapStoreConfig
setFactoryImplementation(java.lang.Object factoryImplementation)
Sets the map store factory implementation object.MapStoreConfig
setImplementation(java.lang.Object implementation)
Sets the map store implementation objectMapStoreConfig
setInitialLoadMode(MapStoreConfig.InitialLoadMode initialLoadMode)
Sets the initial load mode.MapStoreConfig
setOffload(boolean offload)
Default value is true.MapStoreConfig
setProperties(java.util.Properties properties)
Sets the propertiesMapStoreConfig
setProperty(java.lang.String name, java.lang.String value)
MapStoreConfig
setWriteBatchSize(int writeBatchSize)
Sets the number of operations to be included in each batch processing round.MapStoreConfig
setWriteCoalescing(boolean writeCoalescing)
SettingwriteCoalescing
is meaningful if you are using write-behindMapStore
.MapStoreConfig
setWriteDelaySeconds(int writeDelaySeconds)
Sets the number of seconds to delay before writing (storing) the dirty recordsjava.lang.String
toString()
void
writeData(ObjectDataOutput out)
Writes object fields to output stream
-
-
-
Field Detail
-
DEFAULT_WRITE_DELAY_SECONDS
public static final int DEFAULT_WRITE_DELAY_SECONDS
Default delay seconds for writing- See Also:
- Constant Field Values
-
DEFAULT_WRITE_BATCH_SIZE
public static final int DEFAULT_WRITE_BATCH_SIZE
Default batch size for writing- See Also:
- Constant Field Values
-
DEFAULT_WRITE_COALESCING
public static final boolean DEFAULT_WRITE_COALESCING
Default write coalescing behavior- See Also:
- Constant Field Values
-
DEFAULT_OFFLOAD
public static final boolean DEFAULT_OFFLOAD
Default offload behavior- See Also:
- Constant Field Values
-
-
Constructor Detail
-
MapStoreConfig
public MapStoreConfig()
-
MapStoreConfig
public MapStoreConfig(MapStoreConfig config)
-
-
Method Detail
-
getClassName
public java.lang.String getClassName()
Returns the name of the MapStore implementation class- Returns:
- the name of the MapStore implementation class
-
setClassName
public MapStoreConfig setClassName(@Nonnull java.lang.String className)
Sets the name for the MapStore implementation class- Parameters:
className
- the name to set for the MapStore implementation class
-
getFactoryClassName
public java.lang.String getFactoryClassName()
Returns the name of the MapStoreFactory implementation class- Returns:
- the name of the MapStoreFactory implementation class
-
setFactoryClassName
public MapStoreConfig setFactoryClassName(@Nonnull java.lang.String factoryClassName)
Sets the name for the MapStoreFactory implementation class- Parameters:
factoryClassName
- the name to set for the MapStoreFactory implementation class
-
getWriteDelaySeconds
public int getWriteDelaySeconds()
Returns the number of seconds to delay the store writes.- Returns:
- the number of seconds to delay the store writes
-
setWriteDelaySeconds
public MapStoreConfig setWriteDelaySeconds(int writeDelaySeconds)
Sets the number of seconds to delay before writing (storing) the dirty recordsDefault value is 0.
- Parameters:
writeDelaySeconds
- the number of seconds to delay before writing the dirty records
-
getWriteBatchSize
public int getWriteBatchSize()
Returns the number of operations to be included in each batch processing round.- Returns:
- write batch size: the number of operations to be included in each batch processing round
-
setWriteBatchSize
public MapStoreConfig setWriteBatchSize(int writeBatchSize)
Sets the number of operations to be included in each batch processing round.Default value is 1.
- Parameters:
writeBatchSize
- the number of operations to be included in each batch processing round
-
isEnabled
public boolean isEnabled()
Returns if this configuration is enabled- Returns:
true
if this configuration is enabled,false
otherwise
-
setEnabled
public MapStoreConfig setEnabled(boolean enabled)
Enables and disables this configuration- Parameters:
enabled
-true
to enables this configuration,false
to disable
-
setOffload
public MapStoreConfig setOffload(boolean offload)
Default value is true.MapStore
interaction can be slow compared to in-memory processing of data, to make partition threads available duringMapStore
interaction for other cluster operations, MapStore/MapLoader implementations are offloaded from partition threads to a different thread pool by default.If you set this property to
false
,MapStore
interaction will be done on partition threads. This may introduce latency for other operations which don't requireMapStore
interaction.- Parameters:
offload
- settrue
to enable offloading, otherwise setfalse
- Since:
- 5.2
-
isOffload
public boolean isOffload()
Default value is true.Enables and disables offloading behavior.
- Returns:
true
if this configuration is enabled,false
otherwise- Since:
- 5.2
- See Also:
setOffload(boolean)
-
setImplementation
public MapStoreConfig setImplementation(@Nonnull java.lang.Object implementation)
Sets the map store implementation object- Parameters:
implementation
- the map store implementation object to set- Returns:
- this MapStoreConfig instance
-
getImplementation
public java.lang.Object getImplementation()
Returns the map store implementation object.- Returns:
- the map store implementation object
-
setFactoryImplementation
public MapStoreConfig setFactoryImplementation(@Nonnull java.lang.Object factoryImplementation)
Sets the map store factory implementation object.- Parameters:
factoryImplementation
- the factory implementation object- Returns:
- this MapStoreConfig instance
-
getFactoryImplementation
public java.lang.Object getFactoryImplementation()
Returns the map store factory implementation object.- Returns:
- the map store factory implementation object
-
setProperty
public MapStoreConfig setProperty(java.lang.String name, java.lang.String value)
-
getProperty
public java.lang.String getProperty(java.lang.String name)
Returns the given property- Returns:
- the given property
-
getProperties
public java.util.Properties getProperties()
Returns all the properties- Returns:
- all the properties
-
setProperties
public MapStoreConfig setProperties(java.util.Properties properties)
Sets the properties- Parameters:
properties
- the properties to be set- Returns:
- this MapStoreConfig
-
getInitialLoadMode
public MapStoreConfig.InitialLoadMode getInitialLoadMode()
Returns the initial load mode.- Returns:
- the initial load mode object
-
setInitialLoadMode
public MapStoreConfig setInitialLoadMode(MapStoreConfig.InitialLoadMode initialLoadMode)
Sets the initial load mode.- LAZY: Default load mode where load is async
- EAGER: load mode where load is blocked till all partitions are loaded
- Parameters:
initialLoadMode
- the initial load mode object
-
isWriteCoalescing
public boolean isWriteCoalescing()
Returnstrue
if write-coalescing is enabled.- Returns:
true
if coalescing enabled,false
otherwise- See Also:
setWriteCoalescing(boolean)
-
setWriteCoalescing
public MapStoreConfig setWriteCoalescing(boolean writeCoalescing)
SettingwriteCoalescing
is meaningful if you are using write-behindMapStore
.When
writeCoalescing
istrue
, only the latest store operation on a key in thewriteDelaySeconds
time-window will be reflected toMapStore
.Default value is true.
- Parameters:
writeCoalescing
-true
to enable write-coalescing, otherwisefalse
.- See Also:
ClusterProperty.MAP_WRITE_BEHIND_QUEUE_CAPACITY
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
equals
public final boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public final int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
getFactoryId
public int getFactoryId()
Description copied from interface:IdentifiedDataSerializable
Returns DataSerializableFactory factory ID for this class.- Specified by:
getFactoryId
in interfaceIdentifiedDataSerializable
- 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 interfaceIdentifiedDataSerializable
- Returns:
- type ID
-
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 interfaceDataSerializable
- Parameters:
out
- output- Throws:
java.io.IOException
- if an I/O error occurs. In particular, anIOException
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 interfaceDataSerializable
- Parameters:
in
- input- Throws:
java.io.IOException
- if an I/O error occurs. In particular, anIOException
may be thrown if the input stream has been closed.
-
-