public interface Message extends Serializable
TYPE_CLUSTER_MANAGER_MESSAGE, TYPE_HEALTH_MONITOR_MESSAGE, TYPE_MASTER_NODE_MESSAGE and TYPE_MCAST_MESSAGE are required.
TYPE_PING_MESSAGE, TYPE_PONG_MESSAGE are optional. i.g. JXTA transport layer doesn't need it.
This message can contain various elements with key-value pair.
i.g. For the purpose of storing a source's PeerID from which the message is sent,
SOURCE_PEER_ID_TAG key is used.| Modifier and Type | Field and Description |
|---|---|
static long |
serialVersionUID |
static String |
SOURCE_PEER_ID_TAG
The element's key for storing and getting source's
PeerID |
static String |
TARGET_PEER_ID_TAG
The element's key for storing and getting destination's
PeerID |
static int |
TYPE_CLUSTER_MANAGER_MESSAGE
The type of the
ClusterManager message |
static int |
TYPE_HEALTH_MONITOR_MESSAGE
The type of
HealthMonitor's message
Currently, HealthMessage will be used for message elements |
static int |
TYPE_MASTER_NODE_MESSAGE
The type of the com.sun.enterprise.mgmt.MasterNode message
|
static int |
TYPE_MCAST_MESSAGE
The type of the
LWRMulticast message |
static int |
TYPE_PING_MESSAGE
Currently, this type is used in only Grizzly transport layer
when
NetworkManager.isConnected(com.sun.enterprise.ee.cms.impl.base.PeerID) send the ping message to suspicious member |
static int |
TYPE_PONG_MESSAGE
Currently, this type is used in only Grizzly transport layer in order to send own liveness to the sender when a ping message is received
|
| Modifier and Type | Method and Description |
|---|---|
Object |
addMessageElement(String key,
Serializable value)
Adds a special element to this message with key-value pair
|
Object |
getMessageElement(String key)
Returns the value to which the specified key is mapped, or
null if this message contains no mapping for the key |
Set<Map.Entry<String,Serializable>> |
getMessageElements()
Returns a
Set element view of the mappings contained in this message |
Buffer |
getPlainBuffer(ExpandableBufferWriterFactory bufferWriterFactory)
Returns a
Buffer of this message |
ByteBuffer |
getPlainByteBuffer()
Returns a
ByteBuffer of this message |
byte[] |
getPlainBytes()
Returns a byte array of this message
|
int |
getType()
Returns the message's type
i.g.
|
int |
getVersion()
Returns the message's version
|
void |
initialize(int type,
Map<String,Serializable> messages)
Initializes this message with initial type and key-value pair's map
|
int |
parseHeader(Buffer buffer,
int offset)
Parses the message's header from given ByteBuffer
|
int |
parseHeader(byte[] bytes,
int offset)
Parses the message's header from given byte array
|
void |
parseMessage(Buffer buffer,
int offset,
int length)
Parses the message's body from given ByteBuffer
|
void |
parseMessage(byte[] bytes,
int offset,
int length)
Parses the message's body from given byte array
|
Object |
removeMessageElement(String key)
Removes the mapping for a key from this message if it is present
|
static final long serialVersionUID
static final int TYPE_CLUSTER_MANAGER_MESSAGE
ClusterManager messagestatic final int TYPE_HEALTH_MONITOR_MESSAGE
HealthMonitor's message
Currently, HealthMessage will be used for message elementsstatic final int TYPE_MASTER_NODE_MESSAGE
static final int TYPE_MCAST_MESSAGE
LWRMulticast messagestatic final int TYPE_PING_MESSAGE
NetworkManager.isConnected(com.sun.enterprise.ee.cms.impl.base.PeerID) send the ping message to suspicious memberstatic final int TYPE_PONG_MESSAGE
static final String SOURCE_PEER_ID_TAG
PeerIDstatic final String TARGET_PEER_ID_TAG
PeerIDvoid initialize(int type,
Map<String,Serializable> messages)
throws IllegalArgumentException
type - message typemessages - key-value pair's messageIllegalArgumentException - if the argument is not validint parseHeader(byte[] bytes,
int offset)
throws IllegalArgumentException
bytes - byte array which should be parsedoffset - offset from which the message should be parsedIllegalArgumentException - if the argument is not valid or an unexpected error occursint parseHeader(Buffer buffer, int offset) throws IllegalArgumentException
buffer - ByteBuffer which should be parsedoffset - offset from which the message should be parsedIllegalArgumentException - if the argument is not valid or an unexpected error occursvoid parseMessage(byte[] bytes,
int offset,
int length)
throws IllegalArgumentException,
MessageIOException
bytes - byte array which should be parsedoffset - offset from which the message should be parsedlength - the message's length(body length)IllegalArgumentException - if the argument is not valid or an unexpected error occursMessageIOException - if an I/O error occursvoid parseMessage(Buffer buffer, int offset, int length) throws IllegalArgumentException, MessageIOException
buffer - ByteBuffer which should be parsedoffset - offset from which the message should be parsedlength - the message's length(body length)IllegalArgumentException - if the argument is not valid or an unexpected error occursMessageIOException - if an I/O error occursint getVersion()
int getType()
TYPE_CLUSTER_MANAGER_MESSAGE or TYPE_HEALTH_MONITOR_MESSAGE's integer value or etc...Object addMessageElement(String key, Serializable value)
key - key with which the specified value is to be associatedvalue - serializable value to be associated with the specified keyObject getMessageElement(String key)
null if this message contains no mapping for the keykey - the key whose associated value is to be returnednull if this message contains no mapping for the keyObject removeMessageElement(String key)
key - key whose mapping is to be removed from the messageSet<Map.Entry<String,Serializable>> getMessageElements()
Set element view of the mappings contained in this messageBuffer getPlainBuffer(ExpandableBufferWriterFactory bufferWriterFactory) throws MessageIOException
Buffer of this messagebufferWriterFactory - ExpandableBufferWriterFactory.MessageIOException - if an I/O error occursByteBuffer getPlainByteBuffer() throws MessageIOException
ByteBuffer of this messageMessageIOException - if an I/O error occursbyte[] getPlainBytes()
throws MessageIOException
MessageIOException - if an I/O error occursCopyright © 2017–2019 Eclipse Foundation. All rights reserved.