fipaos.util
Class Monitor

java.lang.Object
  |
  +--java.lang.Thread
        |
        +--fipaos.util.Monitor
Direct Known Subclasses:
MultiThreadedMonitor

public class Monitor
extends Thread

This class provides a generic mechanism for forwarding objects
from one thread to another in order to decouple parts of a system.
A Queue must be passed to a Monitor upon construction, and it monitors
this for objects to forward. When there is an object in the queue
it is passed to the MonitorListener registered with the Monitor




Fields inherited from class java.lang.Thread
MIN_PRIORITY, NORM_PRIORITY, MAX_PRIORITY

Constructor Summary
Monitor(Queue queue, MonitorListener ml)
          Constructor - starts threads running
Monitor(Queue queue, MonitorListener ml, int priority)
          Constructor - starts threads running

Method Summary
 voidhalt()
          Invoked when this should exit cleanly
 static voidmain(String[] args)
          Test harness for Monitor class
 synchronized voidrun()
          Run method - continuously checks for
incomming messages, and passes them on to
the MonitorListener implementations associated
with this

Methods inherited from class java.lang.Thread
currentThread, yield, sleep, sleep, start, stop, stop, interrupt, interrupted, isInterrupted, destroy, isAlive, suspend, resume, setPriority, getPriority, setName, getName, getThreadGroup, activeCount, enumerate, countStackFrames, join, join, join, dumpStack, setDaemon, isDaemon, checkAccess, toString, getContextClassLoader, setContextClassLoader

Methods inherited from class java.lang.Object
getClass, hashCode, equals, notify, notifyAll, wait, wait, wait

Constructor Detail

Monitor

public Monitor(Queue queue, MonitorListener ml)
Constructor - starts threads running
Parameters:
queue - The queue that should be used for buffering waiting
objects
ml - The MonitorListener to forward objects to

Monitor

public Monitor(Queue queue, MonitorListener ml, int priority)
Constructor - starts threads running
Parameters:
queue - The queue that should be used for buffering waiting
objects
ml - The MonitorListener to forward objects to
Method Detail

halt

public void halt()
Invoked when this should exit cleanly

main

public static void main(String[] args)
Test harness for Monitor class

run

public synchronized void run()
Run method - continuously checks for
incomming messages, and passes them on to
the MonitorListener implementations associated
with this

Association Links

to Class fipaos.util.Queue

The queue being used to store the objects

to Class fipaos.util.MonitorListener

The target MonitorListener