public class JobResultSerializer extends com.esotericsoftware.kryo.Serializer<BaseProtocol.JobResult<?>>
Serializer
for serializing / deserializing BaseProtocol.JobResult
objects. This class uses Java serialization to write / read the JobResult objects. This has
the nice property that it is able to successfully serialize Java Throwable
s. Whereas
the Kryo serializer cannot (because certain objects in a Throwable don't have public zero-arg
constructors.
Given that any developer can write a custom exception that contains non-serializable objects
(e.g. objects that don't implement Serializable
), this class needs to handle
the case where the given Throwable cannot be serialized by Java. In this case, the
serializer will recursively go through the Throwable
and wrap all objects with a
RuntimeException
which is guaranteed to be serializable.
Constructor and Description |
---|
JobResultSerializer() |
Modifier and Type | Method and Description |
---|---|
BaseProtocol.JobResult<?> |
read(com.esotericsoftware.kryo.Kryo kryo,
com.esotericsoftware.kryo.io.Input input,
Class type) |
void |
write(com.esotericsoftware.kryo.Kryo kryo,
com.esotericsoftware.kryo.io.Output output,
BaseProtocol.JobResult<?> object) |
public BaseProtocol.JobResult<?> read(com.esotericsoftware.kryo.Kryo kryo, com.esotericsoftware.kryo.io.Input input, Class type)
read
in class com.esotericsoftware.kryo.Serializer<BaseProtocol.JobResult<?>>
public void write(com.esotericsoftware.kryo.Kryo kryo, com.esotericsoftware.kryo.io.Output output, BaseProtocol.JobResult<?> object)
write
in class com.esotericsoftware.kryo.Serializer<BaseProtocol.JobResult<?>>
Copyright © 2022 The Apache Software Foundation. All rights reserved.