Class ChannelData
java.lang.Object
org.apache.catalina.tribes.io.ChannelData
- All Implemented Interfaces:
- Serializable,- Cloneable,- ChannelMessage
The 
ChannelData object is used to transfer a message through the channel interceptor stack and
 eventually out on a transport to be sent to another node. While the message is being processed by the different
 interceptors, the message data can be manipulated as each interceptor seems appropriate.- Author:
- Peter Rossbach
- See Also:
- 
Field SummaryFields
- 
Constructor SummaryConstructorsConstructorDescriptionCreates an empty channel data with a new unique IdChannelData(boolean generateUUID) Create an empty channel data objectChannelData(byte[] uniqueId, XByteBuffer message, long timestamp) Creates a new channel data object with data
- 
Method SummaryModifier and TypeMethodDescriptionstatic StringbToS(byte[] data) clone()Create a shallow clone, only the data gets recreatedDeep clone, all fields MUST get clonedbooleanCompares to ChannelData objects, only compares on getUniqueId().equals(o.getUniqueId())voidGenerates a UUID and invokes setUniqueIdGet the address that this message originated from.static ChannelDatagetDataFromPackage(byte[] b) static ChannelDataDeserializes a ChannelData object from a byte arraybyte[]Serializes the ChannelData object into a byte[] arraybyte[]getDataPackage(byte[] data, int offset) intreturns the byte buffer that contains the actual message payloadintThe message options is a 32 bit flag set that triggers interceptors and message behavior.longTimestamp of when the message was created.byte[]Each message must have a globally unique Id. interceptors heavily depend on this id for message processinginthashCode()static booleansendAckAsync(int options) Utility method, returns true if the options flag indicates that an ack is to be sent after the message has been received but not yet processedstatic booleansendAckSync(int options) Utility method, returns true if the options flag indicates that an ack is to be sent after the message has been received and processedvoidsetAddress(Member address) Sets the source or reply-to address of this messagevoidsetMessage(XByteBuffer message) The byte buffer that contains the actual message payloadvoidsetOptions(int options) sets the option bits for this messagevoidsetTimestamp(long timestamp) Sets the timestamp of this message.voidsetUniqueId(byte[] uniqueId) toString()
- 
Field Details- 
EMPTY_DATA_ARRAY
- 
USE_SECURE_RANDOM_FOR_UUIDpublic static volatile boolean USE_SECURE_RANDOM_FOR_UUID
 
- 
- 
Constructor Details- 
ChannelDatapublic ChannelData()Creates an empty channel data with a new unique Id- See Also:
 
- 
ChannelDatapublic ChannelData(boolean generateUUID) Create an empty channel data object- Parameters:
- generateUUID- boolean - if true, a unique Id will be generated
 
- 
ChannelDataCreates a new channel data object with data- Parameters:
- uniqueId- - unique message id
- message- - message data
- timestamp- - message timestamp
 
 
- 
- 
Method Details- 
getMessageDescription copied from interface:ChannelMessagereturns the byte buffer that contains the actual message payload- Specified by:
- getMessagein interface- ChannelMessage
- Returns:
- XByteBuffer
 
- 
setMessageDescription copied from interface:ChannelMessageThe byte buffer that contains the actual message payload- Specified by:
- setMessagein interface- ChannelMessage
- Parameters:
- message- XByteBuffer
 
- 
getTimestamppublic long getTimestamp()Description copied from interface:ChannelMessageTimestamp of when the message was created.- Specified by:
- getTimestampin interface- ChannelMessage
- Returns:
- long timestamp in milliseconds
 
- 
setTimestamppublic void setTimestamp(long timestamp) Description copied from interface:ChannelMessageSets the timestamp of this message.- Specified by:
- setTimestampin interface- ChannelMessage
- Parameters:
- timestamp- The timestamp
 
- 
getUniqueIdpublic byte[] getUniqueId()Description copied from interface:ChannelMessageEach message must have a globally unique Id. interceptors heavily depend on this id for message processing- Specified by:
- getUniqueIdin interface- ChannelMessage
- Returns:
- byte
 
- 
setUniqueIdpublic void setUniqueId(byte[] uniqueId) 
- 
getOptionspublic int getOptions()Description copied from interface:ChannelMessageThe message options is a 32 bit flag set that triggers interceptors and message behavior.- Specified by:
- getOptionsin interface- ChannelMessage
- Returns:
- int - the option bits set for this message
- See Also:
 
- 
setOptionspublic void setOptions(int options) Description copied from interface:ChannelMessagesets the option bits for this message- Specified by:
- setOptionsin interface- ChannelMessage
- Parameters:
- options- int
- See Also:
 
- 
getAddressDescription copied from interface:ChannelMessageGet the address that this message originated from. Almost alwaysChannel.getLocalMember(boolean). This would be set to a different address if the message was being relayed from a host other than the one that originally sent it.- Specified by:
- getAddressin interface- ChannelMessage
- Returns:
- the source or reply-to address of this message
 
- 
setAddressDescription copied from interface:ChannelMessageSets the source or reply-to address of this message- Specified by:
- setAddressin interface- ChannelMessage
- Parameters:
- address- Member
 
- 
generateUUIDpublic void generateUUID()Generates a UUID and invokes setUniqueId
- 
getDataPackageLengthpublic int getDataPackageLength()
- 
getDataPackagepublic byte[] getDataPackage()Serializes the ChannelData object into a byte[] array- Returns:
- byte[]
 
- 
getDataPackagepublic byte[] getDataPackage(byte[] data, int offset) 
- 
getDataFromPackageDeserializes a ChannelData object from a byte array- Parameters:
- xbuf- byte[]
- Returns:
- ChannelData
 
- 
getDataFromPackage
- 
hashCode
- 
equals
- 
cloneCreate a shallow clone, only the data gets recreated- Specified by:
- clonein interface- ChannelMessage
- Overrides:
- clonein class- Object
- Returns:
- ClusterData
 
- 
deepcloneDescription copied from interface:ChannelMessageDeep clone, all fields MUST get cloned- Specified by:
- deepclonein interface- ChannelMessage
- Returns:
- ChannelMessage
 
- 
sendAckSyncpublic static boolean sendAckSync(int options) Utility method, returns true if the options flag indicates that an ack is to be sent after the message has been received and processed- Parameters:
- options- int - the options for the message
- Returns:
- boolean
- See Also:
 
- 
sendAckAsyncpublic static boolean sendAckAsync(int options) Utility method, returns true if the options flag indicates that an ack is to be sent after the message has been received but not yet processed- Parameters:
- options- int - the options for the message
- Returns:
- boolean
- See Also:
 
- 
toString
- 
bToS
 
-