universal
Class Message

java.lang.Object
  |
  +--universal.Message
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
AmAliveMessage, ReadMessage, universal.WriteMessage

public abstract class Message
extends java.lang.Object
implements java.io.Serializable

This class is the superclass for all the kind of messages exchanges for the consensus and leader election purposes.

See Also:
Serialized Form

Field Summary
static int ACK_READ_MSG
           
static int ACK_WRITE_MSG
           
static int AM_ALIVE_MSG
           
 int mid
           
 int msgType
          Define the type of the message.
static int NACK_READ_MSG
           
static int NACK_WRITE_MSG
           
static int READ_MSG
           
 int senderid
          the pid of the replicated server that send this message
static int WRITE_MSG
           
 
Constructor Summary
Message()
           
 
Method Summary
static universal.Message decode(byte[] byteArray)
          When you want to decode a message whatever is its type you have to call the Decode function of this class which is going to first decode the common variable of all the messages and then to call the Decode function of his real type.
 byte[] encode()
          When you want to encode a message, you should call the encode function of the real type of the message and not this one.
 int msgId()
           
 int msgType()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

senderid

public int senderid
the pid of the replicated server that send this message


mid

public int mid

msgType

public int msgType
Define the type of the message.
For example if it is an AckReadMessage or an AckWriteMessage,..


ACK_READ_MSG

public static final int ACK_READ_MSG
See Also:
Constant Field Values

ACK_WRITE_MSG

public static final int ACK_WRITE_MSG
See Also:
Constant Field Values

AM_ALIVE_MSG

public static final int AM_ALIVE_MSG
See Also:
Constant Field Values

NACK_READ_MSG

public static final int NACK_READ_MSG
See Also:
Constant Field Values

NACK_WRITE_MSG

public static final int NACK_WRITE_MSG
See Also:
Constant Field Values

READ_MSG

public static final int READ_MSG
See Also:
Constant Field Values

WRITE_MSG

public static final int WRITE_MSG
See Also:
Constant Field Values
Constructor Detail

Message

public Message()
Method Detail

decode

public static universal.Message decode(byte[] byteArray)
When you want to decode a message whatever is its type you have to call the Decode function of this class which is going to first decode the common variable of all the messages and then to call the Decode function of his real type.


encode

public byte[] encode()
When you want to encode a message, you should call the encode function of the real type of the message and not this one.


msgId

public int msgId()

msgType

public int msgType()