Class Rendezvous<Msg extends Serializable>

    • Method Detail

      • create

        public static <Msg extends SerializableRendezvous<Msg> create​(Class<Msg> msgClass)
        A new Rendezvous for messages of type MSGCLASS.
      • create

        public static <Msg extends SerializableRendezvous<Msg> create()
        A new Rendezvous for messages of unchecked type.
      • deposit

        public boolean deposit​(Msg msg,
                               long millis)
                        throws InterruptedException,
                               RemoteException
        Deposit MSG in this Mailbox, if this can be done within approximately MILLIS milliseconds. Returns true iff the message was deposited. Does not block if MILLIS is 0. MSG must be non-null. Throws Interrupted exception and does nothing if current thread is interrupted.
        Throws:
        InterruptedException
        RemoteException
      • receive

        public Msg receive()
                    throws InterruptedException
        Receive the next queued message in this Mailbox. Throws Interrupted exception and does nothing if current thread is interrupted.
        Throws:
        InterruptedException
      • receive

        public Msg receive​(long millis)
                    throws InterruptedException
        Receive the next queued message in this Mailbox, if one is available within MILLIS milliseconds. Returns null otherwise. Does not block if MILLIS is 0. Throws Interrupted exception and does nothing if current thread is interrupted.
        Throws:
        InterruptedException
      • stopForwarding

        public void stopForwarding()
        Stop forwarding copies of messages.
      • flush

        public boolean flush​(long millis)
                      throws InterruptedException
        Wait for any queued message to be received, or MILLIS milliseconds, whichever comes first. Returns true if all pending messages were flushed within the time limit.
        Throws:
        InterruptedException
      • close

        public void close​(long millis)
                   throws InterruptedException
        Performs a flush(MILLIS) and then invalidates THIS for all future use, deleting all remaining messages. Any waiting threads or subsequent calls receive an immediate InvalidStateException indicating an invalid state. In general, the thread that uses a Mailbox to send messages is the one that closes it.
        Throws:
        InterruptedException
      • awaitClose

        public void awaitClose()
                        throws InterruptedException
        Wait for THIS to be closed. Receives and throws away any messages sent to THIS. Throws InterruptedException if current thread is interrupted first.
        Throws:
        InterruptedException
      • awaitClose

        public boolean awaitClose​(long millis)
                           throws InterruptedException
        Wait for THIS to be closed, or MILLIS milliseconds, whichever comes first. Receives and throws away any messages sent to THIS. Returns true iff box is closed. Throws InterruptedException if current thread is interrupted first.
        Throws:
        InterruptedException
      • isForwarding

        public boolean isForwarding()
        True iff THIS is currently forwarding messages as a result of forwardTo.
      • isClosed

        public boolean isClosed()
        Description copied from interface: Mailbox
        True iff THIS is closed.
      • capacity

        public int capacity()
        The capacity (see interface comment above) of THIS.
      • messageType

        public Class<Msg> messageType()
        Description copied from interface: Mailbox
        The (runtime) type of message sent through this box.
        Specified by:
        messageType in interface Mailbox<Msg extends Serializable>