public final class Message extends Object implements Serializable, Encodable
Modifier and Type | Class and Description |
---|---|
(package private) static class |
Message.Factory |
Modifier and Type | Field and Description |
---|---|
(package private) short |
dest
The unique id. of destination server
|
(package private) static byte |
DETACHABLE |
(package private) AgentId |
from
AgentId of sender. |
(package private) static int |
LENGTH |
(package private) Notification |
not
The notification.
|
(package private) static byte |
NOTNULL |
(package private) static byte |
NULL |
(package private) static byte |
PERSISTENT |
private static Pool |
pool |
private SerializableWrapper |
serializedNot |
(package private) static long |
serialVersionUID
define serialVersionUID for interoperability
|
(package private) short |
source
The unique id. of source server
|
(package private) int |
stamp
The current stamp of the message
|
private String |
stringId |
(package private) AgentId |
to
AgentId of destination agent. |
BOOLEAN_ENCODED_SIZE, BYTE_ENCODED_SIZE, DOUBLE_ENCODED_SIZE, FLOAT_ENCODED_SIZE, INT_ENCODED_SIZE, LONG_ENCODED_SIZE, SHORT_ENCODED_SIZE
Modifier | Constructor and Description |
---|---|
private |
Message()
Construct a new message.
|
Modifier and Type | Method and Description |
---|---|
(package private) static Message |
alloc()
Allocates a message from the pool.
|
(package private) static Message |
alloc(AgentId from,
AgentId to,
Notification not)
Allocates a message from the pool.
|
StringBuffer |
appendToString(StringBuffer strbuf)
Adds a string representation for this object in the
StringBuffer parameter.
|
void |
decode(Decoder decoder)
Decodes the content of this object
|
(package private) void |
delete()
Deletes the current object in persistent storage.
|
void |
encode(Encoder encoder)
Encodes the content of this object
|
(package private) void |
free()
Frees the message to the pool.
|
short |
getDest()
Get the unique server id. of the addressee of this message
|
int |
getEncodableClassId()
Returns a unique class identifier.
|
int |
getEncodedSize()
Returns the size of the byte array that results
from the encoding of this object.
|
AgentId |
getFrom() |
Notification |
getNot() |
short |
getSource()
Get the unique server id. of the sender of this message
|
int |
getStamp()
Get the stamp of this message
|
AgentId |
getTo() |
boolean |
isPersistent()
Tests if the associated notification is persistent or not.
|
(package private) static Message |
load(String name)
Restores the object state from the persistent storage.
|
(package private) void |
optFromByte(byte opt) |
(package private) byte |
optToByte() |
private void |
readObject(ObjectInputStream in)
The readObject method is responsible for reading from the stream and
restoring the classes fields.
|
(package private) void |
save()
Saves the object state on persistent storage.
|
private void |
set(AgentId from,
AgentId to,
Notification not) |
String |
toString()
Returns a string representation for this object.
|
(package private) String |
toStringId() |
private void |
writeObject(ObjectOutputStream out)
The writeObject method is responsible for writing the state of the
object for its particular class so that the corresponding readObject
method can restore it.
|
static final long serialVersionUID
transient AgentId from
AgentId
of sender.transient AgentId to
AgentId
of destination agent.transient Notification not
transient short source
transient short dest
transient int stamp
static final int LENGTH
static final byte NULL
static final byte NOTNULL
static final byte PERSISTENT
static final byte DETACHABLE
private transient String stringId
private static Pool pool
private SerializableWrapper serializedNot
public short getSource()
public short getDest()
public int getStamp()
public AgentId getFrom()
public AgentId getTo()
public Notification getNot()
public String toString()
public StringBuffer appendToString(StringBuffer strbuf)
byte optToByte()
void optFromByte(byte opt)
private void writeObject(ObjectOutputStream out) throws IOException
IOException
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException
IOException
ClassNotFoundException
final String toStringId()
public boolean isPersistent()
void save() throws IOException
IOException
static Message load(String name) throws IOException, ClassNotFoundException
IOException
- when accessing the stored imageClassNotFoundException
- if the stored image class may not be foundvoid delete()
static Message alloc()
static Message alloc(AgentId from, AgentId to, Notification not)
from
- id of source Agent.to
- id of destination Agent.not
- Notification to be signaled.void free()
private void set(AgentId from, AgentId to, Notification not)
public int getEncodableClassId()
Encodable
getEncodableClassId
in interface Encodable
public int getEncodedSize() throws Exception
Encodable
getEncodedSize
in interface Encodable
Exception
- if an error occurspublic void encode(Encoder encoder) throws Exception
Encodable
Copyright © 2019 ScalAgent D.T.. All rights reserved.