All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class timer.WaitQueue

java.lang.Object
   |
   +----timer.WaitQueue

public class WaitQueue
extends Object
A utility class to queue up clients and process their actions (which are presumed to take simulated time) in order. Each WaitQueue serves one server object, and keeps a reference to it to synchronize properly with its monitor. It is assumed that the queue interface will be used from withing synchronized methods.


Constructor Index

 o WaitQueue(Object)
Create a new queue to work with a particular server object

Method Index

 o SignalNext()
remove the current thread from the front of the queue, and let the next waiter (if any) run.
 o Wait()
queue up the current thread, and block until it reaches the front of the queue (might not block if the queue is currently empty.

Constructors

 o WaitQueue
 public WaitQueue(Object obj)
Create a new queue to work with a particular server object

Parameters:
obj - the server object from which the queue's methods will be called

Methods

 o Wait
 public void Wait() throws IllegalMonitorStateException
queue up the current thread, and block until it reaches the front of the queue (might not block if the queue is currently empty.

 o SignalNext
 public void SignalNext() throws IllegalMonitorStateException, IllegalWaitQueueStateException
remove the current thread from the front of the queue, and let the next waiter (if any) run.


All Packages  Class Hierarchy  This Package  Previous  Next  Index