|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.ericsson.otp.erlang.OtpMsg
public class OtpMsg
Provides a carrier for Erlang messages.
Instances of this class are created to package header and payload information
in received Erlang messages so that the recipient can obtain both parts with
a single call to receiveMsg()
.
The header information that is available is as follows:
pid
or as a String, but never both.
regSendTag
contain sender information.
Message are sent using the Erlang external format (see separate
documentation). When a message is received and delivered to the recipient
mailbox
, the body of the message is still in this external
representation until getMsg()
is called, at which point the
message is decoded. A copy of the decoded message is stored in the OtpMsg so
that subsequent calls to getMsg()
do not require that the
message be decoded a second time.
Field Summary | |
---|---|
static int |
exit2Tag
|
static int |
exitTag
|
protected OtpErlangPid |
from
|
static int |
linkTag
|
protected OtpInputStream |
paybuf
|
protected OtpErlangObject |
payload
|
static int |
regSendTag
|
static int |
sendTag
|
protected int |
tag
|
protected OtpErlangPid |
to
|
protected java.lang.String |
toName
|
static int |
unlinkTag
|
Method Summary | |
---|---|
OtpErlangObject |
getMsg()
Deserialize and return a new copy of the message contained in this OtpMsg. |
java.lang.Object |
getRecipient()
Get the name of the recipient for this message, if it is a regSendTag message. |
java.lang.String |
getRecipientName()
Get the name of the recipient for this message. |
OtpErlangPid |
getRecipientPid()
Get the Pid of the recipient for this message, if it is a sendTag message. |
OtpErlangPid |
getSenderPid()
Get the Pid of the sender of this message. |
int |
type()
Get the type marker from this message. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int linkTag
public static final int sendTag
public static final int exitTag
public static final int unlinkTag
public static final int regSendTag
public static final int exit2Tag
protected int tag
protected OtpInputStream paybuf
protected OtpErlangObject payload
protected OtpErlangPid from
protected OtpErlangPid to
protected java.lang.String toName
Method Detail |
---|
public int type()
Get the type marker from this message. The type marker identifies the type of message. Valid values are the ``tag'' constants defined in this class.
The tab identifies not only the type of message but also the content of the OtpMsg object, since different messages have different components, as follows:
Pid
and it is available through getRecipientPid()
. Sender information is not available.
The message body can be retrieved with getMsg()
. getRecipientName()
. Sender information is available through
#getSenderPid getSenderPid()}. The message body can be retrieved with
getMsg()
. getMsg()
.
public OtpErlangObject getMsg() throws OtpErlangDecodeException
Deserialize and return a new copy of the message contained in this OtpMsg.
The first time this method is called the actual payload is deserialized and the Erlang term is created. Calling this method subsequent times will not cuase the message to be deserialized additional times, instead the same Erlang term object will be returned.
OtpErlangDecodeException
- if the byte stream could not be deserialized.public java.lang.String getRecipientName()
Get the name of the recipient for this message.
Messages are sent to Pids or names. If this message was sent to a name then the name is returned by this method.
public OtpErlangPid getRecipientPid()
Get the Pid of the recipient for this message, if it is a sendTag message.
Messages are sent to Pids or names. If this message was sent to a Pid then the Pid is returned by this method. The recipient Pid is also available for link, unlink and exit messages.
public java.lang.Object getRecipient()
Get the name of the recipient for this message, if it is a regSendTag message.
Messages are sent to Pids or names. If this message was sent to a name then the name is returned by this method.
public OtpErlangPid getSenderPid()
Get the Pid of the sender of this message.
For messages sent to names, the Pid of the sender is included with the message. The sender Pid is also available for link, unlink and exit messages. It is not available for sendTag messages sent to Pids.
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |