|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.rmi.server.RemoteObject java.rmi.server.RemoteServer java.rmi.server.UnicastRemoteObject ucb.util.mailbox.QueuedMailbox<Msg>
public class QueuedMailbox<Msg extends Serializable>
A Mailbox with a specified (positive) capacity
Field Summary | |
---|---|
protected int |
capacity
|
protected int |
depositBlocks
|
protected boolean |
open
|
protected LinkedList<Msg> |
queue
|
Fields inherited from class java.rmi.server.RemoteObject |
---|
ref |
Constructor Summary | |
---|---|
protected |
QueuedMailbox(Class<Msg> msgClass,
int capacity)
A new QueuedMailbox with given CAPACITY carrying messages of type MSGCLASS. |
Method Summary | ||
---|---|---|
int |
capacity()
The capacity (see interface comment above) of THIS. |
|
|
checkType(Class<T> msgClass)
Returns THIS, assuming that THIS conveys messages of class MSGCLASS. |
|
void |
close()
Short for close (0). |
|
void |
close(long millis)
Performs a flush(MILLIS) and then invalidates THIS for all future use, deleting all remaining messages. |
|
static
|
create(Class<Msg> msgClass,
int capacity)
A new QueuedMailbox |
|
static
|
create(int capacity)
A new QueuedMailbox with capacity () fixed at CAPACITY, with no type checking. |
|
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. |
|
protected void |
enqueue(Msg msg)
Place MSG at the end of the message queue. |
|
boolean |
flush(long millis)
Wait for all queued messages to be received, or MILLIS milliseconds, whichever comes first. |
|
protected void |
forward(Msg msg,
long millis)
Perform forwarding of MSG to all recipients, waiting for up to MILLIS milliseconds for each deposit to be accepted. |
|
void |
forwardTo(List<Mailbox<Msg>> boxes)
Forward copies of all messages (including any already present) to BOXES in the order received. |
|
void |
forwardTo(Mailbox<Msg> box)
Forward copies of all messages (including any already present) to BOXES in the order received. |
|
boolean |
isClosed()
True iff THIS is closed. |
|
boolean |
isForwarding()
True iff THIS is currently forwarding messages as a result of forwardTo. |
|
Class<Msg> |
messageType()
The (runtime) type of message sent through this box. |
|
protected long |
myWait(long limit)
Wait for up to LIMIT milliseconds or the next notify or interrupt. |
|
Msg |
receive()
Receive the next queued message in this Mailbox. |
|
Msg |
receive(long millis)
Receive the next queued message in this Mailbox, if one is available within MILLIS milliseconds. |
|
void |
stopForwarding()
Stop forwarding copies of messages. |
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 |
Field Detail |
---|
protected final LinkedList<Msg extends Serializable> queue
protected int capacity
protected boolean open
protected int depositBlocks
Constructor Detail |
---|
protected QueuedMailbox(Class<Msg> msgClass, int capacity) throws RemoteException
RemoteException
Method Detail |
---|
public static <Msg extends Serializable> QueuedMailbox<Msg> create(Class<Msg> msgClass, int capacity)
public static <Msg extends Serializable> QueuedMailbox<Msg> create(int capacity)
public void deposit(Msg msg) throws InterruptedException, RemoteException
InterruptedException
RemoteException
public boolean deposit(Msg msg, long millis) throws InterruptedException, RemoteException
InterruptedException
RemoteException
public Msg receive() throws InterruptedException
InterruptedException
public Msg receive(long millis) throws InterruptedException
InterruptedException
public void forwardTo(Mailbox<Msg> box) throws InterruptedException, RemoteException
InterruptedException
RemoteException
public void forwardTo(List<Mailbox<Msg>> boxes) throws InterruptedException, RemoteException
InterruptedException
RemoteException
public void stopForwarding()
public boolean flush(long millis) throws InterruptedException
InterruptedException
public void close(long millis) throws InterruptedException
InterruptedException
public void close() throws InterruptedException
InterruptedException
public boolean isForwarding()
public boolean isClosed()
public int capacity()
protected void enqueue(Msg msg)
protected void forward(Msg msg, long millis) throws RemoteException, InterruptedException
RemoteException
InterruptedException
protected long myWait(long limit) throws InterruptedException
InterruptedException
public Class<Msg> messageType()
Mailbox
messageType
in interface Mailbox<Msg extends Serializable>
public <T extends Serializable> Mailbox<T> checkType(Class<T> msgClass)
Mailbox
checkType
in interface Mailbox<Msg extends Serializable>
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |