All Packages Class Hierarchy This Package Previous Next Index
Class tos.Inbox
java.lang.Object
|
+----tos.Inbox
- public final class Inbox
- extends Object
...
Inbox inbox = new Inbox("MyBox");
while (true) {
while (inbox.size()>0)
handle(inbox.next());
try {
synchronized(inbox){ inbox.wait(5000); }
} catch (Exception e) {
e.printStackTrace();
}
}
...
Note: An inbox is notified every time some data is posted to it.
- Version:
- $Id: Inbox.java,v 1.4 2000/11/16 15:35:10 lauvset Exp $
- Author:
- Kåre Jørgen Lauvset [kaare@cs.uit.no]
-
Inbox(String)
- Create inbox.
-
close()
- Close inbox.
-
next()
- Get next object reference.
-
post(String, Object)
- Post data to inbox.
-
size()
- Get current inbox size.
Inbox
public Inbox(String nm)
- Create inbox.
- Parameters:
- nm - inbox name.
close
public void close()
- Close inbox. No more data can be posted to the inbox when it is closed.
size
public int size()
- Get current inbox size.
- Returns:
- current number of object references in inbox.
next
public Object next()
- Get next object reference.
- Returns:
- the next object reference from the inbox.
post
public static void post(String nm,
Object rf)
- Post data to inbox.
- Parameters:
- nm - inbox name.
- rf - object reference.
All Packages Class Hierarchy This Package Previous Next Index