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]

Constructor Index

 o Inbox(String)
Create inbox.

Method Index

 o close()
Close inbox.
 o next()
Get next object reference.
 o post(String, Object)
Post data to inbox.
 o size()
Get current inbox size.

Constructors

 o Inbox
 public Inbox(String nm)
Create inbox.

Parameters:
nm - inbox name.

Methods

 o close
 public void close()
Close inbox. No more data can be posted to the inbox when it is closed.

 o size
 public int size()
Get current inbox size.

Returns:
current number of object references in inbox.
 o next
 public Object next()
Get next object reference.

Returns:
the next object reference from the inbox.
 o 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