org.knopflerfish.framework.Queue Class Reference

List of all members.


Detailed Description

The Queue class represents a first-in-first-out (FIFO) queue of objects.

Author:
Per Lundgren

Definition at line 44 of file Queue.java.


Public Member Functions

 Queue (int size)
 Constructs an Queue with the specifies maximum size.
synchronized void insert (Object item) throws IndexOutOfBoundsException
 Inserts an item into the queue.
synchronized void insertFirst (Object item)
 Inserts an item first into the queue.
synchronized Object removeWait (float timeout)
 Removes and returns the first item in the queue.
Object remove ()
 Removes and returns the first object in the queue.
synchronized void close ()
 Closes the queue, i.e.

Constructor & Destructor Documentation

org.knopflerfish.framework.Queue.Queue ( int  size  ) 

Constructs an Queue with the specifies maximum size.

Parameters:
size maximum queue size.

Definition at line 54 of file Queue.java.


Member Function Documentation

synchronized void org.knopflerfish.framework.Queue.insert ( Object  item  )  throws IndexOutOfBoundsException

Inserts an item into the queue.

If there are threads blocked on remove, one of them is unblocked.

Parameters:
item the item to be inserted.
Exceptions:
IndexOutOfBoundsException if maximum queue size is reached.

Definition at line 67 of file Queue.java.

synchronized void org.knopflerfish.framework.Queue.insertFirst ( Object  item  ) 

Inserts an item first into the queue.

If there are threads blocked on remove, one of them is unblocked.

Parameters:
item the item to be inserted.

Definition at line 84 of file Queue.java.

synchronized Object org.knopflerfish.framework.Queue.removeWait ( float  timeout  ) 

Removes and returns the first item in the queue.

If the queue is empty, the calling thread will block.

Parameters:
timeout timeout in seconds.
Returns:
The first item in the queue, or null if a timeout occurred. To distinguish timeouts, null items should not be inserted in the queue.

Definition at line 100 of file Queue.java.

Referenced by org.knopflerfish.framework.Queue.remove().

Object org.knopflerfish.framework.Queue.remove (  ) 

Removes and returns the first object in the queue.

Same as remove(float timeout) but this function blocks forever.

Returns:
The first item in the queue.

Definition at line 134 of file Queue.java.

References org.knopflerfish.framework.Queue.removeWait().

synchronized void org.knopflerfish.framework.Queue.close (  ) 

Closes the queue, i.e.

wakes up all threads blocking on a call to remove().

Definition at line 146 of file Queue.java.


The documentation for this class was generated from the following file:
Generated on Mon Jan 11 21:19:19 2010 for OpenMobileIS by  doxygen 1.5.4