public class MessageSerializer extends SerializerWithStringManifest implements BaseSerializer
ClusterMetricsMessage
types.Constructor and Description |
---|
MessageSerializer(ExtendedActorSystem system) |
Modifier and Type | Method and Description |
---|---|
byte[] |
compress(akka.protobuf.MessageLite msg) |
byte[] |
decompress(byte[] bytes) |
java.lang.Object |
fromBinary(byte[] bytes,
java.lang.String manifest)
Produces an object from an array of bytes, with an optional type-hint;
the class should be loaded using ActorSystem.dynamicAccess.
|
int |
identifier()
Completely unique value to identify this implementation of Serializer, used to optimize network traffic.
|
java.lang.String |
manifest(java.lang.Object obj)
Return the manifest (type hint) that will be provided in the fromBinary method.
|
ExtendedActorSystem |
system()
Actor system which is required by most serializer implementations.
|
byte[] |
toBinary(java.lang.Object obj)
Serializes the given object into an Array of Byte
|
fromBinary, includeManifest
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
identifierFromConfig, SerializationIdentifiers
fromBinary, fromBinary, fromBinary, includeManifest
public MessageSerializer(ExtendedActorSystem system)
public int identifier()
SerializerWithStringManifest
identifier
in interface BaseSerializer
identifier
in interface Serializer
identifier
in class SerializerWithStringManifest
public ExtendedActorSystem system()
BaseSerializer
system
in interface BaseSerializer
public java.lang.String manifest(java.lang.Object obj)
SerializerWithStringManifest
""
if manifest is not needed.manifest
in class SerializerWithStringManifest
obj
- (undocumented)public byte[] toBinary(java.lang.Object obj)
SerializerWithStringManifest
toBinary
in interface Serializer
toBinary
in class SerializerWithStringManifest
obj
- (undocumented)public byte[] compress(akka.protobuf.MessageLite msg)
public byte[] decompress(byte[] bytes)
public java.lang.Object fromBinary(byte[] bytes, java.lang.String manifest)
SerializerWithStringManifest
It's recommended to throw java.io.NotSerializableException
in fromBinary
if 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. NotSerializableException
is 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.
fromBinary
in class SerializerWithStringManifest
bytes
- (undocumented)manifest
- (undocumented)