Package com.hazelcast.config
Class SerializationConfig
java.lang.Object
com.hazelcast.config.SerializationConfig
Contains the serialization configuration of
HazelcastInstance
.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionaddClassDefinition
(ClassDefinition classDefinition) Deprecated, for removal: This API element is subject to removal in a future version.Portable Serialization has been deprecated.addDataSerializableFactory
(int factoryId, DataSerializableFactory dataSerializableFactory) addDataSerializableFactoryClass
(int factoryId, Class<? extends DataSerializableFactory> dataSerializableFactoryClass) addDataSerializableFactoryClass
(int factoryId, String dataSerializableFactoryClass) addPortableFactory
(int factoryId, PortableFactory portableFactory) Deprecated, for removal: This API element is subject to removal in a future version.Portable Serialization has been deprecated.addPortableFactoryClass
(int factoryId, Class<? extends PortableFactory> portableFactoryClass) Deprecated, for removal: This API element is subject to removal in a future version.Portable Serialization has been deprecated.addPortableFactoryClass
(int factoryId, String portableFactoryClass) Deprecated, for removal: This API element is subject to removal in a future version.Portable Serialization has been deprecated.addSerializerConfig
(SerializerConfig serializerConfig) boolean
Note that result of useNativeByteOrder is not reflected to return value of this method.Deprecated, for removal: This API element is subject to removal in a future version.Portable Serialization has been deprecated.Deprecated, for removal: This API element is subject to removal in a future version.Portable Serialization has been deprecated.Deprecated, for removal: This API element is subject to removal in a future version.Portable Serialization has been deprecated.int
Deprecated, for removal: This API element is subject to removal in a future version.Portable Serialization has been deprecated.int
hashCode()
boolean
boolean
Unsafe, it is not public api of java.boolean
Default value istrue
(enabled).boolean
Enables compression when default java serialization is used.boolean
Enables shared object when default java serialization is used.boolean
setAllowOverrideDefaultSerializers
(boolean allowOverrideDefaultSerializers) This configuration should be used cautiously.setAllowUnsafe
(boolean allowUnsafe) Unsafe, it is not public api of java.setByteOrder
(ByteOrder byteOrder) Note that configuring use native byte order as enabled will override the byte order set by this method.setCheckClassDefErrors
(boolean checkClassDefErrors) When enabled, serialization system will check for class definitions error at start and throw an Serialization Exception with error definition.setClassDefinitions
(Set<ClassDefinition> classDefinitions) Deprecated, for removal: This API element is subject to removal in a future version.Portable Serialization has been deprecated.setCompactSerializationConfig
(CompactSerializationConfig compactSerializationConfig) setDataSerializableFactories
(Map<Integer, DataSerializableFactory> dataSerializableFactories) setDataSerializableFactoryClasses
(Map<Integer, String> dataSerializableFactoryClasses) setEnableCompression
(boolean enableCompression) Enables compression when default java serialization is used.setEnableSharedObject
(boolean enableSharedObject) Enables shared object when default java serialization is used.setGlobalSerializerConfig
(GlobalSerializerConfig globalSerializerConfig) setJavaSerializationFilterConfig
(JavaSerializationFilterConfig javaSerializationFilterConfig) Allows to configure deserialization protection filter.setPortableFactories
(Map<Integer, PortableFactory> portableFactories) Deprecated, for removal: This API element is subject to removal in a future version.Portable Serialization has been deprecated.setPortableFactoryClasses
(Map<Integer, String> portableFactoryClasses) Deprecated, for removal: This API element is subject to removal in a future version.Portable Serialization has been deprecated.setPortableVersion
(int portableVersion) Deprecated, for removal: This API element is subject to removal in a future version.Portable Serialization has been deprecated.setSerializerConfigs
(Collection<SerializerConfig> serializerConfigs) setUseNativeByteOrder
(boolean useNativeByteOrder) toString()
-
Constructor Details
-
SerializationConfig
public SerializationConfig() -
SerializationConfig
-
-
Method Details
-
getGlobalSerializerConfig
- Returns:
- the global serializer configuration
- See Also:
-
setGlobalSerializerConfig
- Parameters:
globalSerializerConfig
- configuration of serializer that will be used if no other serializer is applicable- Returns:
- GlobalSerializerConfig
-
getSerializerConfigs
- Returns:
- list of
SerializerConfig
s
-
addSerializerConfig
- Parameters:
serializerConfig
- serializer configuration of a class type- Returns:
- configured
SerializerConfig
for chaining
-
setSerializerConfigs
- Parameters:
serializerConfigs
- lists of serializer configs that will be registered- Returns:
- configured
SerializerConfig
for chaining
-
getPortableVersion
Deprecated, for removal: This API element is subject to removal in a future version.Portable Serialization has been deprecated. We recommend you use Compact Serialization as Portable Serialization will be removed as of version 7.0.Portable version will be used to differentiate two versions of the same class that have changes on the class, like adding/removing a field or changing a type of a field.- Returns:
- version of portable classes
-
setPortableVersion
@Deprecated(since="5.4", forRemoval=true) public SerializationConfig setPortableVersion(int portableVersion) Deprecated, for removal: This API element is subject to removal in a future version.Portable Serialization has been deprecated. We recommend you use Compact Serialization as Portable Serialization will be removed as of version 7.0.- Parameters:
portableVersion
- int value for the version of portable classes- Returns:
- configured
SerializerConfig
for chaining
-
getDataSerializableFactoryClasses
- Returns:
- map of factory ID and corresponding factory class names
- See Also:
-
setDataSerializableFactoryClasses
public SerializationConfig setDataSerializableFactoryClasses(Map<Integer, String> dataSerializableFactoryClasses) - Parameters:
dataSerializableFactoryClasses
- map of factory ID and corresponding factory class names- Returns:
- configured
SerializerConfig
for chaining - See Also:
-
addDataSerializableFactoryClass
public SerializationConfig addDataSerializableFactoryClass(int factoryId, String dataSerializableFactoryClass) - Parameters:
factoryId
- factory ID of dataSerializableFactory to be registereddataSerializableFactoryClass
- name of dataSerializableFactory class to be registered- Returns:
- configured
SerializerConfig
for chaining - See Also:
-
addDataSerializableFactoryClass
public SerializationConfig addDataSerializableFactoryClass(int factoryId, Class<? extends DataSerializableFactory> dataSerializableFactoryClass) - Parameters:
factoryId
- factory ID of dataSerializableFactory to be registereddataSerializableFactoryClass
- dataSerializableFactory class to be registered- Returns:
- configured
SerializerConfig
for chaining - See Also:
-
getDataSerializableFactories
- Returns:
- map of factory ID and corresponding dataSerializable factories
- See Also:
-
setDataSerializableFactories
public SerializationConfig setDataSerializableFactories(Map<Integer, DataSerializableFactory> dataSerializableFactories) - Parameters:
dataSerializableFactories
- map of factory ID and corresponding dataSerializable objects- Returns:
- configured
SerializerConfig
for chaining - See Also:
-
addDataSerializableFactory
public SerializationConfig addDataSerializableFactory(int factoryId, DataSerializableFactory dataSerializableFactory) - Parameters:
factoryId
- factory ID of DataSerializableFactory to be registereddataSerializableFactory
- DataSerializableFactory object to be registered- Returns:
- configured
SerializerConfig
for chaining - See Also:
-
getPortableFactoryClasses
Deprecated, for removal: This API element is subject to removal in a future version.Portable Serialization has been deprecated. We recommend you use Compact Serialization as Portable Serialization will be removed as of version 7.0.- Returns:
- map of factory ID and corresponding portable factory names
- See Also:
-
setPortableFactoryClasses
@Deprecated(since="5.4", forRemoval=true) public SerializationConfig setPortableFactoryClasses(Map<Integer, String> portableFactoryClasses) Deprecated, for removal: This API element is subject to removal in a future version.Portable Serialization has been deprecated. We recommend you use Compact Serialization as Portable Serialization will be removed as of version 7.0.- Parameters:
portableFactoryClasses
- map of factory ID and corresponding factory class names- Returns:
- configured
SerializerConfig
for chaining - See Also:
-
addPortableFactoryClass
@Deprecated(since="5.4", forRemoval=true) public SerializationConfig addPortableFactoryClass(int factoryId, Class<? extends PortableFactory> portableFactoryClass) Deprecated, for removal: This API element is subject to removal in a future version.Portable Serialization has been deprecated. We recommend you use Compact Serialization as Portable Serialization will be removed as of version 7.0.- Parameters:
factoryId
- factory ID of portableFactory to be registeredportableFactoryClass
- portableFactory class to be registered- Returns:
- configured
SerializerConfig
for chaining - See Also:
-
addPortableFactoryClass
@Deprecated(since="5.4", forRemoval=true) public SerializationConfig addPortableFactoryClass(int factoryId, String portableFactoryClass) Deprecated, for removal: This API element is subject to removal in a future version.Portable Serialization has been deprecated. We recommend you use Compact Serialization as Portable Serialization will be removed as of version 7.0.- Parameters:
factoryId
- factory ID of portableFactory to be registeredportableFactoryClass
- name of the portableFactory class to be registered- Returns:
- configured
SerializerConfig
for chaining - See Also:
-
getPortableFactories
@Deprecated(since="5.4", forRemoval=true) public Map<Integer,PortableFactory> getPortableFactories()Deprecated, for removal: This API element is subject to removal in a future version.Portable Serialization has been deprecated. We recommend you use Compact Serialization as Portable Serialization will be removed as of version 7.0.- Returns:
- map of factory ID and corresponding portable factories
- See Also:
-
setPortableFactories
@Deprecated(since="5.4", forRemoval=true) public SerializationConfig setPortableFactories(Map<Integer, PortableFactory> portableFactories) Deprecated, for removal: This API element is subject to removal in a future version.Portable Serialization has been deprecated. We recommend you use Compact Serialization as Portable Serialization will be removed as of version 7.0.- Parameters:
portableFactories
- map of factory ID and corresponding factory objects- Returns:
- configured
SerializerConfig
for chaining - See Also:
-
addPortableFactory
@Deprecated(since="5.4", forRemoval=true) public SerializationConfig addPortableFactory(int factoryId, PortableFactory portableFactory) Deprecated, for removal: This API element is subject to removal in a future version.Portable Serialization has been deprecated. We recommend you use Compact Serialization as Portable Serialization will be removed as of version 7.0.- Parameters:
factoryId
- factory ID of portableFactory to be registeredportableFactory
- portableFactory object to be registered- Returns:
- configured
SerializerConfig
for chaining - See Also:
-
getClassDefinitions
Deprecated, for removal: This API element is subject to removal in a future version.Portable Serialization has been deprecated. We recommend you use Compact Serialization as Portable Serialization will be removed as of version 7.0.- Returns:
- registered class definitions of portable classes
- See Also:
-
addClassDefinition
@Deprecated(since="5.4", forRemoval=true) public SerializationConfig addClassDefinition(ClassDefinition classDefinition) Deprecated, for removal: This API element is subject to removal in a future version.Portable Serialization has been deprecated. We recommend you use Compact Serialization as Portable Serialization will be removed as of version 7.0.- Parameters:
classDefinition
- the class definition to be registered- Returns:
- configured
SerializerConfig
for chaining - See Also:
-
setClassDefinitions
@Deprecated(since="5.4", forRemoval=true) public SerializationConfig setClassDefinitions(Set<ClassDefinition> classDefinitions) Deprecated, for removal: This API element is subject to removal in a future version.Portable Serialization has been deprecated. We recommend you use Compact Serialization as Portable Serialization will be removed as of version 7.0.- Parameters:
classDefinitions
- set of class definitions to be registered- Returns:
- configured
SerializerConfig
for chaining - See Also:
-
isCheckClassDefErrors
public boolean isCheckClassDefErrors()Default value istrue
(enabled). When enabled, serialization system will check for class definitions error at start and throw an Serialization Exception with error definition.- Returns:
true
if enabled,false
otherwise
-
setCheckClassDefErrors
When enabled, serialization system will check for class definitions error at start and throw an Serialization Exception with error definition.- Parameters:
checkClassDefErrors
- set tofalse
to disable- Returns:
- configured
SerializerConfig
for chaining
-
isUseNativeByteOrder
public boolean isUseNativeByteOrder()- Returns:
true
if serialization is configured to use native byte order of the underlying platform
-
setUseNativeByteOrder
- Parameters:
useNativeByteOrder
- set totrue
to use native byte order of the underlying platform- Returns:
- configured
SerializerConfig
for chaining
-
getByteOrder
Note that result of useNativeByteOrder is not reflected to return value of this method.- Returns:
- configured byte order
-
setByteOrder
Note that configuring use native byte order as enabled will override the byte order set by this method.- Parameters:
byteOrder
- that serialization will use- Returns:
- configured
SerializerConfig
for chaining
-
isEnableCompression
public boolean isEnableCompression()Enables compression when default java serialization is used.- Returns:
true
if compression enabled
-
setEnableCompression
Enables compression when default java serialization is used.- Parameters:
enableCompression
- set totrue
to enable compression- Returns:
- configured
SerializerConfig
for chaining
-
isAllowUnsafe
public boolean isAllowUnsafe()Unsafe, it is not public api of java. Use with caution!Default value is
false
.- Returns:
true
if using unsafe is allowed,false
otherwise
-
setAllowUnsafe
Unsafe, it is not public api of java. Use with caution!- Parameters:
allowUnsafe
- set totrue
to allow usage of unsafe- Returns:
- configured
SerializerConfig
for chaining
-
isAllowOverrideDefaultSerializers
public boolean isAllowOverrideDefaultSerializers()- Returns:
true
if default serializers may be overridden by custom serializers- Since:
- 4.2
-
setAllowOverrideDefaultSerializers
public SerializationConfig setAllowOverrideDefaultSerializers(boolean allowOverrideDefaultSerializers) This configuration should be used cautiously.Default serializers are used heavily by the hazelcast internally. If any of the instance in the same cluster overrides a default serializer, all the members and clients in the same cluster must override it with the same serializer.
This configuration is introduced specifically to support the following case:
- There was a custom configuration by the user for a type
- Hazelcast decided to add a default serializer for the same type in a future release
To be able to support Rolling Upgrade from an old version to the new version, one needs to make sure of the backward compatibility of the serialization. As a solution, the user will set this property on the new version so that new instances will be able to override new default serializers with their existing custom serializers.
- Parameters:
allowOverrideDefaultSerializers
- value to set- Returns:
- configured
SerializerConfig
for chaining - Since:
- 4.2
-
getJavaSerializationFilterConfig
- Returns:
- the javaSerializationFilterConfig
-
setJavaSerializationFilterConfig
public SerializationConfig setJavaSerializationFilterConfig(JavaSerializationFilterConfig javaSerializationFilterConfig) Allows to configure deserialization protection filter.- Parameters:
javaSerializationFilterConfig
- the javaFilterConfig to set (may benull
)
-
setCompactSerializationConfig
public SerializationConfig setCompactSerializationConfig(@Nonnull CompactSerializationConfig compactSerializationConfig) - Parameters:
compactSerializationConfig
- config for the compact serialization format- Returns:
- configured
SerializerConfig
for chaining - Since:
- 5.2
-
getCompactSerializationConfig
- Returns:
- compact serialization config
- Since:
- 5.2
-
toString
-
equals
-
hashCode
public int hashCode()
-