org.apache.catalina.tribes

Class ByteMessage

public class ByteMessage extends Object implements Serializable, Externalizable

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 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.

Version: $Revision: 467222 $, $Date: 2006-10-24 05:17:11 +0200 (Tue, 24 Oct 2006) $

Author: Filip Hanik

Constructor Summary
ByteMessage()
Creates an empty byte message Constructor also for deserialization
ByteMessage(byte[] data)
Creates a byte message wit h
Method Summary
byte[]getMessage()
Returns the message contents of this byte message
voidreadExternal(ObjectInput in)
voidsetMessage(byte[] message)
Sets the message contents of this byte message
voidwriteExternal(ObjectOutput out)

Constructor Detail

ByteMessage

public ByteMessage()
Creates an empty byte message Constructor also for deserialization

ByteMessage

public ByteMessage(byte[] data)
Creates a byte message wit h

Parameters: data byte[] - the message contents

Method Detail

getMessage

public byte[] getMessage()
Returns the message contents of this byte message

Returns: byte[] - message contents, can be null

readExternal

public void readExternal(ObjectInput in)

Parameters: in ObjectInput

Throws: IOException

See Also: java.io.Externalizable#readExternal

setMessage

public void setMessage(byte[] message)
Sets the message contents of this byte message

Parameters: message byte[]

writeExternal

public void writeExternal(ObjectOutput out)

Parameters: out ObjectOutput

Throws: IOException

See Also: java.io.Externalizable#writeExternal

Copyright © 2000-2011 Apache Software Foundation. All Rights Reserved.