Class SerializerConfigImpl
- java.lang.Object
-
- org.apache.flink.api.common.serialization.SerializerConfigImpl
-
- All Implemented Interfaces:
Serializable,SerializerConfig
@Internal public final class SerializerConfigImpl extends Object implements SerializerConfig
The default implement ofSerializerConfig.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description SerializerConfigImpl()SerializerConfigImpl(Configuration configuration, ExecutionConfig executionConfig)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddDefaultKryoSerializer(Class<?> type, Class<? extends com.esotericsoftware.kryo.Serializer<?>> serializerClass)Adds a new Kryo default serializer to the Runtime.<T extends com.esotericsoftware.kryo.Serializer<?> & Serializable>
voidaddDefaultKryoSerializer(Class<?> type, T serializer)Adds a new Kryo default serializer to the Runtime.voidconfigure(ReadableConfig configuration, ClassLoader classLoader)Sets all relevant options contained in theReadableConfigsuch as e.g.booleanequals(Object obj)LinkedHashMap<Class<?>,Class<? extends com.esotericsoftware.kryo.Serializer<?>>>getDefaultKryoSerializerClasses()Returns the registered default Kryo Serializer classes.LinkedHashMap<Class<?>,ExecutionConfig.SerializableSerializer<?>>getDefaultKryoSerializers()Returns the registered default Kryo Serializers.ExecutionConfiggetExecutionConfig()Note: This method is used only for compatibility whileTypeInformation.createSerializer(ExecutionConfig)is deprecated; If it is removed, this method will also be removed.LinkedHashSet<Class<?>>getRegisteredKryoTypes()Returns the registered Kryo types.LinkedHashSet<Class<?>>getRegisteredPojoTypes()Returns the registered POJO types.Map<Class<?>,Class<? extends TypeInfoFactory<?>>>getRegisteredTypeInfoFactories()Returns the registered type info factories.LinkedHashMap<Class<?>,Class<? extends com.esotericsoftware.kryo.Serializer<?>>>getRegisteredTypesWithKryoSerializerClasses()Returns the registered types with their Kryo Serializer classes.LinkedHashMap<Class<?>,ExecutionConfig.SerializableSerializer<?>>getRegisteredTypesWithKryoSerializers()Returns the registered types with Kryo Serializers.booleanhasGenericTypesDisabled()Checks whether generic types are supported.inthashCode()booleanisForceAvroEnabled()Returns whether the Apache Avro is the serializer for POJOs.booleanisForceKryoEnabled()Returns whether Kryo is the serializer for POJOs.voidregisterKryoType(Class<?> type)Registers the given type with the serialization stack.voidregisterPojoType(Class<?> type)Registers the given type with the serialization stack.voidregisterTypeWithKryoSerializer(Class<?> type, Class<? extends com.esotericsoftware.kryo.Serializer> serializerClass)Registers the given Serializer via its class as a serializer for the given type at the KryoSerializer.<T extends com.esotericsoftware.kryo.Serializer<?> & Serializable>
voidregisterTypeWithKryoSerializer(Class<?> type, T serializer)Registers the given type with a Kryo Serializer.voidsetForceAvro(boolean forceAvro)The method will be converted to private in the next Flink major version after removing its deprecated caller methods.voidsetForceKryo(boolean forceKryo)The method will be converted to private in the next Flink major version after removing its deprecated caller methods.voidsetGenericTypes(boolean genericTypes)The method will be converted to private in the next Flink major version after removing its deprecated caller methods.StringtoString()
-
-
-
Constructor Detail
-
SerializerConfigImpl
public SerializerConfigImpl()
-
SerializerConfigImpl
@Internal public SerializerConfigImpl(Configuration configuration, ExecutionConfig executionConfig)
-
-
Method Detail
-
addDefaultKryoSerializer
public <T extends com.esotericsoftware.kryo.Serializer<?> & Serializable> void addDefaultKryoSerializer(Class<?> type, T serializer)
Adds a new Kryo default serializer to the Runtime.Note that the serializer instance must be serializable (as defined by java.io.Serializable), because it may be distributed to the worker nodes by java serialization.
- Specified by:
addDefaultKryoSerializerin interfaceSerializerConfig- Parameters:
type- The class of the types serialized with the given serializer.serializer- The serializer to use.
-
addDefaultKryoSerializer
public void addDefaultKryoSerializer(Class<?> type, Class<? extends com.esotericsoftware.kryo.Serializer<?>> serializerClass)
Adds a new Kryo default serializer to the Runtime.- Specified by:
addDefaultKryoSerializerin interfaceSerializerConfig- Parameters:
type- The class of the types serialized with the given serializer.serializerClass- The class of the serializer to use.
-
registerTypeWithKryoSerializer
public <T extends com.esotericsoftware.kryo.Serializer<?> & Serializable> void registerTypeWithKryoSerializer(Class<?> type, T serializer)
Registers the given type with a Kryo Serializer.Note that the serializer instance must be serializable (as defined by java.io.Serializable), because it may be distributed to the worker nodes by java serialization.
- Specified by:
registerTypeWithKryoSerializerin interfaceSerializerConfig- Parameters:
type- The class of the types serialized with the given serializer.serializer- The serializer to use.
-
registerTypeWithKryoSerializer
public void registerTypeWithKryoSerializer(Class<?> type, Class<? extends com.esotericsoftware.kryo.Serializer> serializerClass)
Registers the given Serializer via its class as a serializer for the given type at the KryoSerializer.- Specified by:
registerTypeWithKryoSerializerin interfaceSerializerConfig- Parameters:
type- The class of the types serialized with the given serializer.serializerClass- The class of the serializer to use.
-
registerPojoType
public void registerPojoType(Class<?> type)
Registers the given type with the serialization stack. If the type is eventually serialized as a POJO, then the type is registered with the POJO serializer. If the type ends up being serialized with Kryo, then it will be registered at Kryo to make sure that only tags are written.- Specified by:
registerPojoTypein interfaceSerializerConfig- Parameters:
type- The class of the type to register.
-
registerKryoType
public void registerKryoType(Class<?> type)
Registers the given type with the serialization stack. If the type is eventually serialized as a POJO, then the type is registered with the POJO serializer. If the type ends up being serialized with Kryo, then it will be registered at Kryo to make sure that only tags are written.- Specified by:
registerKryoTypein interfaceSerializerConfig- Parameters:
type- The class of the type to register.
-
getRegisteredTypesWithKryoSerializers
public LinkedHashMap<Class<?>,ExecutionConfig.SerializableSerializer<?>> getRegisteredTypesWithKryoSerializers()
Returns the registered types with Kryo Serializers.- Specified by:
getRegisteredTypesWithKryoSerializersin interfaceSerializerConfig
-
getRegisteredTypesWithKryoSerializerClasses
public LinkedHashMap<Class<?>,Class<? extends com.esotericsoftware.kryo.Serializer<?>>> getRegisteredTypesWithKryoSerializerClasses()
Returns the registered types with their Kryo Serializer classes.- Specified by:
getRegisteredTypesWithKryoSerializerClassesin interfaceSerializerConfig
-
getDefaultKryoSerializers
public LinkedHashMap<Class<?>,ExecutionConfig.SerializableSerializer<?>> getDefaultKryoSerializers()
Returns the registered default Kryo Serializers.- Specified by:
getDefaultKryoSerializersin interfaceSerializerConfig
-
getDefaultKryoSerializerClasses
public LinkedHashMap<Class<?>,Class<? extends com.esotericsoftware.kryo.Serializer<?>>> getDefaultKryoSerializerClasses()
Returns the registered default Kryo Serializer classes.- Specified by:
getDefaultKryoSerializerClassesin interfaceSerializerConfig
-
getRegisteredKryoTypes
public LinkedHashSet<Class<?>> getRegisteredKryoTypes()
Returns the registered Kryo types.- Specified by:
getRegisteredKryoTypesin interfaceSerializerConfig
-
getRegisteredPojoTypes
public LinkedHashSet<Class<?>> getRegisteredPojoTypes()
Returns the registered POJO types.- Specified by:
getRegisteredPojoTypesin interfaceSerializerConfig
-
getRegisteredTypeInfoFactories
public Map<Class<?>,Class<? extends TypeInfoFactory<?>>> getRegisteredTypeInfoFactories()
Returns the registered type info factories.- Specified by:
getRegisteredTypeInfoFactoriesin interfaceSerializerConfig
-
hasGenericTypesDisabled
public boolean hasGenericTypesDisabled()
Checks whether generic types are supported. Generic types are types that go through Kryo during serialization.Generic types are enabled by default.
- Specified by:
hasGenericTypesDisabledin interfaceSerializerConfig
-
setGenericTypes
public void setGenericTypes(boolean genericTypes)
Description copied from interface:SerializerConfigThe method will be converted to private in the next Flink major version after removing its deprecated caller methods.- Specified by:
setGenericTypesin interfaceSerializerConfig
-
isForceKryoEnabled
public boolean isForceKryoEnabled()
Returns whether Kryo is the serializer for POJOs.- Specified by:
isForceKryoEnabledin interfaceSerializerConfig
-
setForceKryo
public void setForceKryo(boolean forceKryo)
Description copied from interface:SerializerConfigThe method will be converted to private in the next Flink major version after removing its deprecated caller methods.- Specified by:
setForceKryoin interfaceSerializerConfig
-
isForceAvroEnabled
public boolean isForceAvroEnabled()
Returns whether the Apache Avro is the serializer for POJOs.- Specified by:
isForceAvroEnabledin interfaceSerializerConfig
-
setForceAvro
public void setForceAvro(boolean forceAvro)
Description copied from interface:SerializerConfigThe method will be converted to private in the next Flink major version after removing its deprecated caller methods.- Specified by:
setForceAvroin interfaceSerializerConfig
-
configure
public void configure(ReadableConfig configuration, ClassLoader classLoader)
Sets all relevant options contained in theReadableConfigsuch as e.g.PipelineOptions.FORCE_KRYO.It will change the value of a setting only if a corresponding option was set in the
configuration. If a key is not present, the current value of a field will remain untouched.- Specified by:
configurein interfaceSerializerConfig- Parameters:
configuration- a configuration to read the values fromclassLoader- a class loader to use when loading classes
-
getExecutionConfig
public ExecutionConfig getExecutionConfig()
Note: This method is used only for compatibility whileTypeInformation.createSerializer(ExecutionConfig)is deprecated; If it is removed, this method will also be removed.
-
-