|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface Message
This represents internal message interface which is sent and received on the top of Shoal management module
Currently, six message types exist.
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.
| Field Summary | |
|---|---|
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 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 |
| Method Summary | |
|---|---|
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 |
| Field Detail |
|---|
static final long serialVersionUID
static final int TYPE_CLUSTER_MANAGER_MESSAGE
ClusterManager message
static final int TYPE_HEALTH_MONITOR_MESSAGE
HealthMonitor's message
Currently, HealthMessage will be used for message elements
static final int TYPE_MASTER_NODE_MESSAGE
MasterNode message
static final int TYPE_MCAST_MESSAGE
LWRMulticast message
static final int TYPE_PING_MESSAGE
NetworkManager.isConnected(com.sun.enterprise.ee.cms.impl.base.PeerID) send the ping message to suspicious member
static final int TYPE_PONG_MESSAGE
static final String SOURCE_PEER_ID_TAG
PeerID
static final String TARGET_PEER_ID_TAG
PeerID
| Method Detail |
|---|
void initialize(int type,
Map<String,Serializable> messages)
throws IllegalArgumentException
type - message typemessages - key-value pair's message
IllegalArgumentException - if the argument is not valid
int parseHeader(byte[] bytes,
int offset)
throws IllegalArgumentException
bytes - byte array which should be parsedoffset - offset from which the message should be parsed
IllegalArgumentException - if the argument is not valid or an unexpected error occurs
int parseHeader(Buffer buffer,
int offset)
throws IllegalArgumentException
buffer - ByteBuffer which should be parsedoffset - offset from which the message should be parsed
IllegalArgumentException - if the argument is not valid or an unexpected error occurs
void 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 occurs
MessageIOException - if an I/O error occurs
void 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 occurs
MessageIOException - 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 key
Object getMessageElement(String key)
null if this message contains no mapping for the key
key - the key whose associated value is to be returned
null if this message contains no mapping for the keyObject removeMessageElement(String key)
key - key whose mapping is to be removed from the message
Set<Map.Entry<String,Serializable>> getMessageElements()
Set element view of the mappings contained in this message
Buffer getPlainBuffer(ExpandableBufferWriterFactory bufferWriterFactory)
throws MessageIOException
Buffer of this message
bufferWriterFactory - ExpandableBufferWriterFactory.
MessageIOException - if an I/O error occurs
ByteBuffer getPlainByteBuffer()
throws MessageIOException
ByteBuffer of this message
MessageIOException - if an I/O error occurs
byte[] getPlainBytes()
throws MessageIOException
MessageIOException - if an I/O error occurs
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||