Interface Mailbox<Msg extends Serializable>

All Superinterfaces:
Remote
All Known Implementing Classes:
QueuedMailbox, Rendezvous, SinkBox

public interface Mailbox<Msg extends Serializable> extends Remote
A repository for messages, suitable for remote use. Has facilities for forwarding copies of messages to other mailboxes. Messages are received and forwarded in the order deposited. A mailbox has a "capacity", which is the maximum allowed excess of completed deposits over completely processed messages. A message is "completely" processed when it has been received (if retains() is true) and has been forwarded to all requesters. A capacity of Integer.MAX_VALUE indicates that there is no set limit. When a Mailbox has a capacity of 0, it synchronizes senders and receivers: a deposit does not complete until its message is picked up by receive (and forwarded, if called for).
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    The capacity (see interface comment above) of THIS.
    <T extends Serializable>
    Mailbox<T>
    checkType(Class<T> msgClass)
    Returns THIS, assuming that THIS conveys messages of class MSGCLASS.
    void
    Short for close (0).
    void
    close(long millis)
    Performs a flush(MILLIS) and then invalidates THIS for all future use, deleting all remaining messages.
    void
    deposit(Msg msg)
    Deposit MSG in this Mailbox.
    boolean
    deposit(Msg msg, long millis)
    Deposit MSG in this Mailbox, if this can be done within approximately MILLIS milliseconds.
    boolean
    flush(long millis)
    Wait for all queued messages to be received, or MILLIS milliseconds, whichever comes first.
    void
    Forward copies of all messages (including any already present) to BOXES in the order received.
    void
    Forward copies of all messages (including any already present) to BOX in the order received.
    boolean
    True iff THIS is closed.
    boolean
    True iff THIS is currently forwarding messages as a result of forwardTo.
    The (runtime) type of message sent through this box.
    Receive the next queued message in this Mailbox.
    receive(long millis)
    Receive the next queued message in this Mailbox, if one is available within MILLIS milliseconds.
    void
    Stop forwarding copies of messages.