ucb.util.mailbox
Class SyncMailbox

java.lang.Object
  |
  +--java.rmi.server.RemoteObject
        |
        +--java.rmi.server.RemoteServer
              |
              +--java.rmi.server.UnicastRemoteObject
                    |
                    +--ucb.util.mailbox.SyncMailbox
All Implemented Interfaces:
Mailbox, java.rmi.Remote, java.io.Serializable

public class SyncMailbox
extends java.rmi.server.UnicastRemoteObject
implements Mailbox

A SyncMailbox has a capacity of 0.

See Also:
Serialized Form

Fields inherited from class java.rmi.server.RemoteObject
ref
 
Constructor Summary
SyncMailbox()
           
 
Method Summary
 int capacity()
          The capacity (see interface comment above) of THIS.
 void close()
          Delete any pending messages and then invalidate this Mailbox, so that further use causes an exception.
 int concurrency()
          The strategy used to forward mail.
 void deposit(java.io.Serializable msg)
          Deposit MSG in this Mailbox.
 boolean depositIfPossible(java.io.Serializable msg)
          Deposit MSG in this Mailbox, if has no message.
 void flush()
          Wait until all pending messages have been received.
 void forwardTo(Mailbox box, boolean forwardCurrent)
          Begin forwarding copies of all messages to BOX in the order received.
 java.io.Serializable receive()
          Receive the next queued message in this Mailbox.
 java.io.Serializable receiveIfPossible()
          Receive the next queued message in this Mailbox, if one is immediately available.
 boolean retains()
          True iff this Mailbox retains messages sent to it for later receipt.
 void stopForwardingTo(Mailbox box)
          Stop forwarding copies of messages to BOX.
 
Methods inherited from class java.rmi.server.UnicastRemoteObject
clone, exportObject, exportObject, exportObject, unexportObject
 
Methods inherited from class java.rmi.server.RemoteServer
getClientHost, getLog, setLog
 
Methods inherited from class java.rmi.server.RemoteObject
equals, getRef, hashCode, toString, toStub
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SyncMailbox

public SyncMailbox()
            throws java.rmi.RemoteException
Method Detail

deposit

public void deposit(java.io.Serializable msg)
             throws java.rmi.RemoteException,
                    java.lang.InterruptedException
Description copied from interface: Mailbox
Deposit MSG in this Mailbox. If the Mailbox is full, wait if necessary for space to be available.
Specified by:
deposit in interface Mailbox

depositIfPossible

public boolean depositIfPossible(java.io.Serializable msg)
                          throws java.rmi.RemoteException,
                                 java.lang.InterruptedException
Deposit MSG in this Mailbox, if has no message. Returns true iff the message was deposited.
Specified by:
depositIfPossible in interface Mailbox

receive

public java.io.Serializable receive()
                             throws java.lang.InterruptedException
Receive the next queued message in this Mailbox.
Specified by:
receive in interface Mailbox

receiveIfPossible

public java.io.Serializable receiveIfPossible()
                                       throws java.lang.InterruptedException
Receive the next queued message in this Mailbox, if one is immediately available. Returns null otherwise.
Specified by:
receiveIfPossible in interface Mailbox

flush

public void flush()
           throws java.lang.InterruptedException
Wait until all pending messages have been received.
Specified by:
flush in interface Mailbox

forwardTo

public void forwardTo(Mailbox box,
                      boolean forwardCurrent)
               throws java.rmi.RemoteException,
                      java.lang.InterruptedException
Begin forwarding copies of all messages to BOX in the order received.
Specified by:
forwardTo in interface Mailbox

stopForwardingTo

public void stopForwardingTo(Mailbox box)
Stop forwarding copies of messages to BOX.
Specified by:
stopForwardingTo in interface Mailbox

close

public void close()
Delete any pending messages and then invalidate this Mailbox, so that further use causes an exception.
Specified by:
close in interface Mailbox

retains

public boolean retains()
True iff this Mailbox retains messages sent to it for later receipt. A mailbox that neither retains nor forwards acts as a bit bucket.
Specified by:
retains in interface Mailbox

capacity

public int capacity()
Description copied from interface: Mailbox
The capacity (see interface comment above) of THIS.
Specified by:
capacity in interface Mailbox

concurrency

public int concurrency()
The strategy used to forward mail.
Specified by:
concurrency in interface Mailbox