Package org.apache.pekko.persistence
Class TestSerializer
java.lang.Object
org.apache.pekko.serialization.SerializerWithStringManifest
org.apache.pekko.persistence.TestSerializer
- All Implemented Interfaces:
Serializer
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfromBinary(byte[] bytes, String manifest) Produces an object from an array of bytes, with an optional type-hint.intCompletely unique value to identify this implementation of Serializer, used to optimize network traffic.Return the manifest (type hint) that will be provided in the fromBinary method.byte[]Serializes the given object into an Array of Byte.Methods inherited from class org.apache.pekko.serialization.SerializerWithStringManifest
fromBinary, includeManifestMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.pekko.serialization.Serializer
fromBinary, fromBinary
-
Constructor Details
-
TestSerializer
-
-
Method Details
-
fromBinary
Description copied from class:SerializerWithStringManifestProduces an object from an array of bytes, with an optional type-hint.It's recommended to throw
java.io.NotSerializableExceptioninfromBinaryif the manifest is unknown. This makes it possible to introduce new message types and send them to nodes that don't know about them. This is typically needed when performing rolling upgrades, i.e. running a cluster with mixed versions for while.NotSerializableExceptionis treated as a transient problem in the TCP based remoting layer. The problem will be logged and message is dropped. Other exceptions will tear down the TCP connection because it can be an indication of corrupt bytes from the underlying transport.- Specified by:
fromBinaryin classSerializerWithStringManifest
-
identifier
public int identifier()Description copied from class:SerializerWithStringManifestCompletely unique value to identify this implementation of Serializer, used to optimize network traffic. Values from 0 to 40 are reserved for Pekko internal usage.- Specified by:
identifierin interfaceSerializer- Specified by:
identifierin classSerializerWithStringManifest
-
manifest
Description copied from class:SerializerWithStringManifestReturn the manifest (type hint) that will be provided in the fromBinary method. Use""if manifest is not needed.- Specified by:
manifestin classSerializerWithStringManifest
-
toBinary
Description copied from class:SerializerWithStringManifestSerializes the given object into an Array of Byte.Note that the array must not be mutated by the serializer after it has been returned.
- Specified by:
toBinaryin interfaceSerializer- Specified by:
toBinaryin classSerializerWithStringManifest
-