@Internal public class TypeSerializerSerializationUtil extends Object
TypeSerializer and TypeSerializerConfigSnapshot.| Modifier and Type | Class and Description |
|---|---|
static class |
TypeSerializerSerializationUtil.TypeSerializerSerializationProxy<T>
Utility serialization proxy for a
TypeSerializer. |
| Constructor and Description |
|---|
TypeSerializerSerializationUtil() |
public static <T> void writeSerializer(DataOutputView out, TypeSerializer<T> serializer) throws IOException
TypeSerializer to the provided data output view.
It is written with a format that can be later read again using
tryReadSerializer(DataInputView, ClassLoader, boolean).
T - Data type of the serializer.out - the data output view.serializer - the serializer to write.IOExceptionpublic static <T> TypeSerializer<T> tryReadSerializer(DataInputView in, ClassLoader userCodeClassLoader)
TypeSerializer that was previously
written using writeSerializer(DataOutputView, TypeSerializer).
If deserialization fails for any reason (corrupted serializer bytes, serializer class
no longer in classpath, serializer class no longer valid, etc.), null will
be returned instead.
T - Data type of the serializer.in - the data input view.userCodeClassLoader - the user code class loader to use.public static <T> TypeSerializer<T> tryReadSerializer(DataInputView in, ClassLoader userCodeClassLoader, boolean useDummyPlaceholder)
TypeSerializer that was previously
written using writeSerializer(DataOutputView, TypeSerializer).
If deserialization fails due to ClassNotFoundException or InvalidClassException,
users can opt to use a dummy UnloadableDummyTypeSerializer to hold the serializer bytes,
otherwise null is returned. If the failure is due to a StreamCorruptedException,
then null is returned.
T - Data type of the serializer.in - the data input view.userCodeClassLoader - the user code class loader to use.useDummyPlaceholder - whether or not to use a dummy UnloadableDummyTypeSerializer to hold the
serializer bytes in the case of a ClassNotFoundException or
InvalidClassException.public static void writeSerializersAndConfigsWithResilience(DataOutputView out, List<Tuple2<TypeSerializer<?>,TypeSerializerConfigSnapshot>> serializersAndConfigs) throws IOException
readSerializersAndConfigsWithResilience(DataInputView, ClassLoader), if
deserialization of the serializer fails, its configuration snapshot will remain intact.
Specifically, all written serializers and their config snapshots are indexed by their offset positions within the serialized bytes. The serialization format is as follows:
out - the data output view.serializersAndConfigs - serializer and configuration snapshot pairsIOExceptionpublic static List<Tuple2<TypeSerializer<?>,TypeSerializerConfigSnapshot>> readSerializersAndConfigsWithResilience(DataInputView in, ClassLoader userCodeClassLoader) throws IOException
writeSerializersAndConfigsWithResilience(DataOutputView, List).
This is fault tolerant to any failures when deserializing the serializers. Serializers which
were not successfully deserialized will be replaced by null.in - the data input view.userCodeClassLoader - the user code class loader to use.IOExceptionpublic static void writeSerializerConfigSnapshot(DataOutputView out, TypeSerializerConfigSnapshot serializerConfigSnapshot) throws IOException
TypeSerializerConfigSnapshot to the provided data output view.
It is written with a format that can be later read again using
readSerializerConfigSnapshot(DataInputView, ClassLoader).
out - the data output viewserializerConfigSnapshot - the serializer configuration snapshot to writeIOExceptionpublic static TypeSerializerConfigSnapshot readSerializerConfigSnapshot(DataInputView in, ClassLoader userCodeClassLoader) throws IOException
TypeSerializerConfigSnapshot that was previously
written using writeSerializerConfigSnapshot(DataOutputView, TypeSerializerConfigSnapshot).in - the data input viewuserCodeClassLoader - the user code class loader to useIOExceptionpublic static void writeSerializerConfigSnapshots(DataOutputView out, TypeSerializerConfigSnapshot... serializerConfigSnapshots) throws IOException
TypeSerializerConfigSnapshots to the provided data output view.
It is written with a format that can be later read again using
readSerializerConfigSnapshots(DataInputView, ClassLoader).
out - the data output viewserializerConfigSnapshots - the serializer configuration snapshots to writeIOExceptionpublic static TypeSerializerConfigSnapshot[] readSerializerConfigSnapshots(DataInputView in, ClassLoader userCodeClassLoader) throws IOException
TypeSerializerConfigSnapshots that was previously
written using writeSerializerConfigSnapshot(DataOutputView, TypeSerializerConfigSnapshot).in - the data input viewuserCodeClassLoader - the user code class loader to useIOExceptionCopyright © 2014–2017 The Apache Software Foundation. All rights reserved.