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
Modifier and TypeMethodDescriptiondeserializeMessage
(byte[] data) Deserialize a byte array into an object message.byte[]
serializeMessage
(ID sharedObjectID, Object message) Serialize an object to byte array.
-
Method Details
-
serializeMessage
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
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.
-