|
Sun SPOT API |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.sun.squawk.io.mailboxes.MailboxAddress
public final class MailboxAddress
A MailboxAddress is a private reference to a remote Mailbox. It is a logical connection between a sender and a Mailbox. MailboxAddress are created by lookupMailbox(), which creates a new MailboxAddress each time called, or by receiving a reference to a MailboxAddress in an envelope. If several isolates want to send messages to the same Mailbox in another isolate, each will use a different MailboxAddress. Even within an isolate, it may be simpler to use different MailboxAddresses to the same Mailbox. Any attempt to call send() on a MailboxAddress to a Mailbox that is closed throws a MailboxClosedException.
| Method Summary | |
|---|---|
void |
close()
Sends a close message to the corresponding Mailbox, explaining that no more messages will be sent via this MailboxAddress. |
MailboxAddress |
getReplyAddress()
Get the reply address that was associated with this address during lookup. |
boolean |
isOpen()
Returns true if close() was called, or a MailboxClosedException was thrown by send(). |
boolean |
isOwner(Isolate anIsolate)
Returns true if anIsolate is the owner of this address. |
static MailboxAddress |
lookupMailbox(String name,
Mailbox replyMailbox)
This method looks up a MailboxAddress that has been registered with the system, and implicitly opens the connection to the remote Mailbox. |
void |
send(Envelope env)
Sends a message to the Mailbox. |
String |
toString()
Returns a string representation of the object. |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Method Detail |
|---|
public void close()
public boolean isOpen()
public boolean isOwner(Isolate anIsolate)
public static MailboxAddress lookupMailbox(String name,
Mailbox replyMailbox)
throws NoSuchMailboxException
name - the name of the Mailbox to lookup.replyAddress - the address of a local mailbox that the remote isolate can send replies to.
name.
NoSuchMailboxException - if there is no mailbox named name.
public void send(Envelope env)
throws AddressClosedException
env - the message to send
IllegateStateException - if the address is not in the open state, or if the caller is not the
"owner" of this MailboxAddress.
AddressClosedExceptionpublic MailboxAddress getReplyAddress()
IllegalStateException - if this address is not openpublic String toString()
ObjecttoString method returns a string that
"textually represents" this object. The result should
be a concise but informative representation that is easy for a
person to read.
It is recommended that all subclasses override this method.
The toString method for class Object
returns a string consisting of the name of the class of which the
object is an instance, the at-sign character `@', and
the unsigned hexadecimal representation of the hash code of the
object. In other words, this method returns a string equal to the
value of:
getClass().getName() + '@' + Integer.toHexString(hashCode())
toString in class Object
|
Sun SPOT API |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||