Interface SerializerConfig
-
- All Superinterfaces:
Serializable
- All Known Implementing Classes:
SerializerConfigImpl
@PublicEvolving public interface SerializerConfig extends Serializable
A config to define the behavior for serializers in Flink job, it manages the registered types and serializers. The config is created from job configuration and used by Flink to create serializers for data types.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated 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.SerializerConfigcopy()LinkedHashMap<Class<?>,Class<? extends com.esotericsoftware.kryo.Serializer<?>>>getDefaultKryoSerializerClasses()Returns the registered default Kryo Serializer classes.LinkedHashMap<Class<?>,ExecutionConfig.SerializableSerializer<?>>getDefaultKryoSerializers()Deprecated.The method is deprecated becauseExecutionConfig.SerializableSerializeris deprecated.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()Deprecated.The method is deprecated because instance-type Kryo serializer definition based onExecutionConfig.SerializableSerializeris deprecated.booleanhasGenericTypesDisabled()Checks whether generic types are supported.booleanisForceAvroEnabled()Returns whether the Apache Avro is the serializer for POJOs.TernaryBooleanisForceKryoAvroEnabled()Returns whether forces Flink to register Apache Avro classes in Kryo serializer.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.voidsetForceKryoAvro(boolean forceKryoAvro)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.
-
-
-
Method Detail
-
addDefaultKryoSerializer
@Internal <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.
The method will be converted to private in the next Flink major version after removing its deprecated caller methods.
- Parameters:
type- The class of the types serialized with the given serializer.serializer- The serializer to use.
-
addDefaultKryoSerializer
@Internal void addDefaultKryoSerializer(Class<?> type, Class<? extends com.esotericsoftware.kryo.Serializer<?>> serializerClass)
Adds a new Kryo default serializer to the Runtime.The method will be converted to private in the next Flink major version after removing its deprecated caller methods.
- Parameters:
type- The class of the types serialized with the given serializer.serializerClass- The class of the serializer to use.
-
registerTypeWithKryoSerializer
@Internal <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.
The method will be converted to private in the next Flink major version after removing its deprecated caller methods.
- Parameters:
type- The class of the types serialized with the given serializer.serializer- The serializer to use.
-
registerTypeWithKryoSerializer
@Internal 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.The method will be converted to private in the next Flink major version after removing its deprecated caller methods.
- Parameters:
type- The class of the types serialized with the given serializer.serializerClass- The class of the serializer to use.
-
registerPojoType
@Internal 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.The method will be converted to private in the next Flink major version after removing its deprecated caller methods.
- Parameters:
type- The class of the type to register.
-
registerKryoType
@Internal 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.The method will be converted to private in the next Flink major version after removing its deprecated caller methods.
- Parameters:
type- The class of the type to register.
-
getRegisteredTypesWithKryoSerializers
@Deprecated LinkedHashMap<Class<?>,ExecutionConfig.SerializableSerializer<?>> getRegisteredTypesWithKryoSerializers()
Deprecated.The method is deprecated because instance-type Kryo serializer definition based onExecutionConfig.SerializableSerializeris deprecated. Use class-type Kryo serializers instead.Returns the registered types with Kryo Serializers.
-
getRegisteredTypesWithKryoSerializerClasses
LinkedHashMap<Class<?>,Class<? extends com.esotericsoftware.kryo.Serializer<?>>> getRegisteredTypesWithKryoSerializerClasses()
Returns the registered types with their Kryo Serializer classes.
-
getDefaultKryoSerializers
@Deprecated LinkedHashMap<Class<?>,ExecutionConfig.SerializableSerializer<?>> getDefaultKryoSerializers()
Deprecated.The method is deprecated becauseExecutionConfig.SerializableSerializeris deprecated.Returns the registered default Kryo Serializers.
-
getDefaultKryoSerializerClasses
LinkedHashMap<Class<?>,Class<? extends com.esotericsoftware.kryo.Serializer<?>>> getDefaultKryoSerializerClasses()
Returns the registered default Kryo Serializer classes.
-
getRegisteredKryoTypes
LinkedHashSet<Class<?>> getRegisteredKryoTypes()
Returns the registered Kryo types.
-
getRegisteredPojoTypes
LinkedHashSet<Class<?>> getRegisteredPojoTypes()
Returns the registered POJO types.
-
getRegisteredTypeInfoFactories
Map<Class<?>,Class<? extends TypeInfoFactory<?>>> getRegisteredTypeInfoFactories()
Returns the registered type info factories.
-
hasGenericTypesDisabled
boolean hasGenericTypesDisabled()
Checks whether generic types are supported. Generic types are types that go through Kryo during serialization.Generic types are enabled by default.
-
setGenericTypes
@Internal void setGenericTypes(boolean genericTypes)
The method will be converted to private in the next Flink major version after removing its deprecated caller methods.
-
isForceKryoEnabled
boolean isForceKryoEnabled()
Returns whether Kryo is the serializer for POJOs.
-
setForceKryo
@Internal void setForceKryo(boolean forceKryo)
The method will be converted to private in the next Flink major version after removing its deprecated caller methods.
-
isForceAvroEnabled
boolean isForceAvroEnabled()
Returns whether the Apache Avro is the serializer for POJOs.
-
setForceAvro
@Internal void setForceAvro(boolean forceAvro)
The method will be converted to private in the next Flink major version after removing its deprecated caller methods.
-
setForceKryoAvro
@Internal void setForceKryoAvro(boolean forceKryoAvro)
The method will be converted to private in the next Flink major version after removing its deprecated caller methods.
-
isForceKryoAvroEnabled
TernaryBoolean isForceKryoAvroEnabled()
Returns whether forces Flink to register Apache Avro classes in Kryo serializer.
-
configure
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.- Parameters:
configuration- a configuration to read the values fromclassLoader- a class loader to use when loading classes
-
copy
SerializerConfig copy()
-
-