Package org.apache.catalina.tribes
Class ByteMessage
java.lang.Object
org.apache.catalina.tribes.ByteMessage
- All Implemented Interfaces:
Externalizable
,Serializable
A byte message is not serialized and deserialized by the channel
instead it is sent as a byte array
By default Tribes uses java serialization when it receives an object to be sent over the wire. Java serialization is not the most efficient of serializing data, and Tribes might not even have access to the correct class loaders to deserialize the object properly.
The ByteMessage class is a class where the channel when it receives it will not attempt to perform serialization, instead it will simply stream the
If you are using multiple applications on top of Tribes you should add some sort of header so that you can decide with the
By default Tribes uses java serialization when it receives an object to be sent over the wire. Java serialization is not the most efficient of serializing data, and Tribes might not even have access to the correct class loaders to deserialize the object properly.
The ByteMessage class is a class where the channel when it receives it will not attempt to perform serialization, instead it will simply stream the
getMessage()
bytes.If you are using multiple applications on top of Tribes you should add some sort of header so that you can decide with the
ChannelListener.accept()
whether this message was intended
for you.- See Also:
-
Constructor Summary
ConstructorDescriptionCreates an empty byte message Constructor also for deserializationByteMessage
(byte[] data) Creates a byte message with -
Method Summary
Modifier and TypeMethodDescriptionbyte[]
Returns the message contents of this byte messagevoid
void
setMessage
(byte[] message) Sets the message contents of this byte messagevoid
-
Constructor Details
-
ByteMessage
public ByteMessage()Creates an empty byte message Constructor also for deserialization -
ByteMessage
public ByteMessage(byte[] data) Creates a byte message with- Parameters:
data
- byte[] - the message contents
-
-
Method Details
-
getMessage
public byte[] getMessage()Returns the message contents of this byte message- Returns:
- byte[] - message contents, can be null
-
setMessage
public void setMessage(byte[] message) Sets the message contents of this byte message- Parameters:
message
- byte[]
-
readExternal
- Specified by:
readExternal
in interfaceExternalizable
- Throws:
IOException
-
writeExternal
- Specified by:
writeExternal
in interfaceExternalizable
- Throws:
IOException
-