|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.apache.catalina.tribes.io.ChannelData
public class ChannelData
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.
| Field Summary | |
|---|---|
static ChannelData[] |
EMPTY_DATA_ARRAY
|
static boolean |
USE_SECURE_RANDOM_FOR_UUID
|
| Constructor Summary | |
|---|---|
ChannelData()
Creates an empty channel data with a new unique Id |
|
ChannelData(boolean generateUUID)
Create an empty channel data object |
|
ChannelData(byte[] uniqueId,
XByteBuffer message,
long timestamp)
Creates a new channel data object with data |
|
| Method Summary | |
|---|---|
static java.lang.String |
bToS(byte[] data)
|
java.lang.Object |
clone()
Create a shallow clone, only the data gets recreated |
java.lang.Object |
deepclone()
Complete clone |
boolean |
equals(java.lang.Object o)
Compares to ChannelData objects, only compares on getUniqueId().equals(o.getUniqueId()) |
void |
generateUUID()
Generates a UUID and invokes setUniqueId |
Member |
getAddress()
Returns the source or reply-to address |
static ChannelData |
getDataFromPackage(byte[] b)
|
static ChannelData |
getDataFromPackage(XByteBuffer xbuf)
Deserializes a ChannelData object from a byte array |
byte[] |
getDataPackage()
Serializes the ChannelData object into a byte[] array |
byte[] |
getDataPackage(byte[] data,
int offset)
|
int |
getDataPackageLength()
|
XByteBuffer |
getMessage()
returns the byte buffer that contains the actual message payload |
int |
getOptions()
The message options is a 32 bit flag set that triggers interceptors and message behavior. |
long |
getTimestamp()
Timestamp of when the message was created. |
byte[] |
getUniqueId()
Each message must have a globally unique Id. |
int |
hashCode()
|
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 |
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 |
void |
setAddress(Member address)
Sets the source or reply-to address |
void |
setMessage(XByteBuffer message)
The byte buffer that contains the actual message payload |
void |
setOptions(int options)
sets the option bits for this message |
void |
setTimestamp(long timestamp)
Sets the timestamp of this message |
void |
setUniqueId(byte[] uniqueId)
|
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static ChannelData[] EMPTY_DATA_ARRAY
public static boolean USE_SECURE_RANDOM_FOR_UUID
| Constructor Detail |
|---|
public ChannelData()
ChannelData(boolean)public ChannelData(boolean generateUUID)
generateUUID - boolean - if true, a unique Id will be generated
public ChannelData(byte[] uniqueId,
XByteBuffer message,
long timestamp)
uniqueId - - unique message idmessage - - message datatimestamp - - message timestamp| Method Detail |
|---|
public XByteBuffer getMessage()
ChannelMessage
getMessage in interface ChannelMessagepublic void setMessage(XByteBuffer message)
ChannelMessage
setMessage in interface ChannelMessagemessage - The message to send.public long getTimestamp()
ChannelMessage
getTimestamp in interface ChannelMessagepublic void setTimestamp(long timestamp)
ChannelMessage
setTimestamp in interface ChannelMessagetimestamp - The timestamp to sendpublic byte[] getUniqueId()
ChannelMessage
getUniqueId in interface ChannelMessagepublic void setUniqueId(byte[] uniqueId)
uniqueId - The uniqueId to send.public int getOptions()
ChannelMessage
getOptions in interface ChannelMessageChannel.send(Member[], Serializable, int),
ChannelInterceptor.getOptionFlag()public void setOptions(int options)
ChannelMessage
setOptions in interface ChannelMessagesets - the message optionsChannelMessage.getOptions()public Member getAddress()
getAddress in interface ChannelMessagepublic void setAddress(Member address)
setAddress in interface ChannelMessageaddress - Memberpublic void generateUUID()
public int getDataPackageLength()
public byte[] getDataPackage()
public byte[] getDataPackage(byte[] data,
int offset)
public static ChannelData getDataFromPackage(XByteBuffer xbuf)
b - byte[]
public static ChannelData getDataFromPackage(byte[] b)
public int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object o)
equals in class java.lang.Objecto - Object
public java.lang.Object clone()
clone in interface ChannelMessageclone in class java.lang.Objectpublic java.lang.Object deepclone()
deepclone in interface ChannelMessagepublic static boolean sendAckSync(int options)
options - int - the options for the message
Channel.SEND_OPTIONS_USE_ACK,
Channel.SEND_OPTIONS_SYNCHRONIZED_ACKpublic static boolean sendAckAsync(int options)
options - int - the options for the message
Channel.SEND_OPTIONS_USE_ACK,
Channel.SEND_OPTIONS_SYNCHRONIZED_ACKpublic java.lang.String toString()
toString in class java.lang.Objectpublic static java.lang.String bToS(byte[] data)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||