uwcse.location
Class ProducerConsumerQueue

java.lang.Object
  |
  +--uwcse.location.ProducerConsumerQueue

public class ProducerConsumerQueue
extends Object

A FIFO container for Objects supporting producer-consumer thread access.

Version:
$Revision: 1.2 $
Author:
Jeffrey Hightower

Field Summary
protected  LinkedList m_queue
           
 
Constructor Summary
ProducerConsumerQueue()
          Create a new Object queue.
 
Method Summary
 int flush()
          Flush all Objects from the queue.
 Object get()
          Block the current thread and wait for an Object to become available.
 void put(Object o)
          Add a new Object to the queue.
 int size()
          Return the current size of the queue.
 void throwAway(int cnt)
          Throw away the given number of elements from the front of the queue.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_queue

protected LinkedList m_queue
Constructor Detail

ProducerConsumerQueue

public ProducerConsumerQueue()
Create a new Object queue.

Method Detail

flush

public int flush()
Flush all Objects from the queue.

Returns:
the integer number of Objects which were removed

throwAway

public void throwAway(int cnt)
Throw away the given number of elements from the front of the queue.


size

public int size()
Return the current size of the queue.


get

public Object get()
Block the current thread and wait for an Object to become available.

See Also:
put(Object)

put

public void put(Object o)
Add a new Object to the queue.

See Also:
get()


This documentation is for the Location Stack v0.8. The latest distribution, the documentation, and the list of contributors to the Location Stack can always be found at http://portolano.cs.washington.edu/projects/location/

© Copyright 2004 University of Washington CSE