Interface ISharedObjectMessageSerializer
-
public interface ISharedObjectMessageSerializer
Serialize/deserialize shared object messages. Instances of this class can be provided to an ISharedObjectContainer (via ISOC.setSharedObjectMessageSerializer) to customize the shared object message serialization. Note that the serializer has to be symmetric, and able to deserialize objects of all relevant classes.- Since:
- 2.0
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Object
deserializeMessage(byte[] data)
Deserialize a byte array into an object message.byte[]
serializeMessage(ID sharedObjectID, Object message)
Serialize an object to byte array.
-
-
-
Method Detail
-
serializeMessage
byte[] serializeMessage(ID sharedObjectID, Object message) throws IOException
Serialize an object to byte array. This method will be called every time a shared object message is sent from one shared object instance to its replica.
Note that this method may be called many times, and should perform as rapidly as possible to support good marshalling performance.
- Parameters:
sharedObjectID
- the ID for the sender shared object. Will not benull
.message
- the object to be serialized as the message.- Returns:
- byte[] that can be deserialized by
deserializeMessage(byte[])
into a corresponding object on a compatible container instance. Must not benull
. - Throws:
IOException
- thrown if data cannot be serialized. Note that exceptions thrown will result in container-level disconnection.
-
deserializeMessage
Object deserializeMessage(byte[] data) throws IOException, ClassNotFoundException
Deserialize a byte array into an object message. This method will be called every time a shared object message is received, but before the resulting Object is delivered to the shared object.
Note that this method may be called many times, and should perform as rapidly as possible to support good marshalling performance.
- Parameters:
data
- the data to use to deserialize. Will not benull
.- Returns:
- Object that is the deserialized instance of the Object.
- Throws:
IOException
- if some problem deserializing from given bytes.ClassNotFoundException
- thrown if class encoded in byte[] cannot be found in local runtime. Note that exceptions thrown will result in container-level disconnection.
-
-