Package akka.serialization
Class SerializerWithStringManifest
- java.lang.Object
-
- akka.serialization.SerializerWithStringManifest
-
- All Implemented Interfaces:
Serializer
- Direct Known Subclasses:
AkkaClusterTypedSerializer
,ArteryMessageSerializer
,AsyncSerializerWithStringManifest
,ClusterClientMessageSerializer
,ClusterMessageSerializer
,ClusterShardingMessageSerializer
,ClusterSingletonMessageSerializer
,DistributedPubSubMessageSerializer
,JacksonSerializer
,JournalPerfSpec.CmdSerializer
,MessageSerializer
,MiscMessageSerializer
,MiscMessageSerializer
,ReplicatedDataSerializer
,ReplicatorMessageSerializer
,ServiceKeySerializer
,ShardingSerializer
,StreamRefSerializer
,TestSerializer
public abstract class SerializerWithStringManifest extends java.lang.Object implements Serializer
Completely unique value to identify this implementation of Serializer, used to optimize network traffic. Values from 0 to 40 are reserved for Akka internal usage.
-
-
Constructor Summary
Constructors Constructor Description SerializerWithStringManifest()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract java.lang.Object
fromBinary(byte[] bytes, java.lang.String manifest)
Produces an object from an array of bytes, with an optional type-hint.java.lang.Object
fromBinary(byte[] bytes, scala.Option<java.lang.Class<?>> manifest)
Produces an object from an array of bytes, with an optional type-hint; the class should be loaded using ActorSystem.dynamicAccess.abstract int
identifier()
Completely unique value to identify this implementation of Serializer, used to optimize network traffic.boolean
includeManifest()
Returns whether this serializer needs a manifest in the fromBinary methodabstract java.lang.String
manifest(java.lang.Object o)
Return the manifest (type hint) that will be provided in the fromBinary method.abstract byte[]
toBinary(java.lang.Object o)
Serializes the given object into an Array of Byte-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface akka.serialization.Serializer
fromBinary, fromBinary
-
-
-
-
Method Detail
-
fromBinary
public abstract java.lang.Object fromBinary(byte[] bytes, java.lang.String manifest) throws java.io.NotSerializableException
Produces an object from an array of bytes, with an optional type-hint.It's recommended to throw
java.io.NotSerializableException
infromBinary
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.- Parameters:
bytes
- (undocumented)manifest
- (undocumented)- Returns:
- (undocumented)
- Throws:
java.io.NotSerializableException
-
fromBinary
public final java.lang.Object fromBinary(byte[] bytes, scala.Option<java.lang.Class<?>> manifest)
Description copied from interface:Serializer
Produces an object from an array of bytes, with an optional type-hint; the class should be loaded using ActorSystem.dynamicAccess.- Specified by:
fromBinary
in interfaceSerializer
- Parameters:
bytes
- (undocumented)manifest
- (undocumented)- Returns:
- (undocumented)
-
identifier
public abstract int identifier()
Description copied from interface:Serializer
Completely unique value to identify this implementation of Serializer, used to optimize network traffic. Values from 0 to 40 are reserved for Akka internal usage.- Specified by:
identifier
in interfaceSerializer
- Returns:
- (undocumented)
-
includeManifest
public final boolean includeManifest()
Description copied from interface:Serializer
Returns whether this serializer needs a manifest in the fromBinary method- Specified by:
includeManifest
in interfaceSerializer
- Returns:
- (undocumented)
-
manifest
public abstract java.lang.String manifest(java.lang.Object o)
Return the manifest (type hint) that will be provided in the fromBinary method. Use""
if manifest is not needed.- Parameters:
o
- (undocumented)- Returns:
- (undocumented)
-
toBinary
public abstract byte[] toBinary(java.lang.Object o)
Serializes the given object into an Array of Byte- Specified by:
toBinary
in interfaceSerializer
- Parameters:
o
- (undocumented)- Returns:
- (undocumented)
-
-