Class JavaSerializer<T>

  • Type Parameters:
    T - The type to be serialized.

    public class JavaSerializer<T>
    extends com.esotericsoftware.kryo.Serializer<T>
    This is a reimplementation of Kryo's JavaSerializer, that additionally makes sure the ObjectInputStream used for deserialization specifically uses Kryo's registered classloader.

    Flink maintains this reimplementation due to a known issue with Kryo's JavaSerializer, in which the wrong classloader may be used for deserialization, leading to ClassNotFoundExceptions.

    See Also:
    FLINK-6025, Known issue with Kryo's JavaSerializer
    • Constructor Detail

      • JavaSerializer

        public JavaSerializer()
    • Method Detail

      • write

        public void write​(com.esotericsoftware.kryo.Kryo kryo,
                          com.esotericsoftware.kryo.io.Output output,
                          T o)
        Specified by:
        write in class com.esotericsoftware.kryo.Serializer<T>
      • read

        public T read​(com.esotericsoftware.kryo.Kryo kryo,
                      com.esotericsoftware.kryo.io.Input input,
                      Class aClass)
        Specified by:
        read in class com.esotericsoftware.kryo.Serializer<T>