fr.dyade.aaa.util
Class Queue

java.lang.Object
  extended byjava.util.AbstractCollection
      extended byjava.util.AbstractList
          extended byjava.util.Vector
              extended byfr.dyade.aaa.util.Queue
All Implemented Interfaces:
java.lang.Cloneable, java.util.Collection, java.util.List, java.util.RandomAccess, java.io.Serializable

public class Queue
extends java.util.Vector

The Queue class implements a First-In-First-Out (FIFO) list of objects.

A queue is for the exclusive use of one single consumer, whereas many producers may access it. It is ready for use after instanciation. A producer may wait for the queue to be empty by calling the stop() method. This method returns when the queue is actually empty, and prohibitis any further call to the push method. To be able to use the queue again, it must be re-started through the start() method.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.util.Vector
capacityIncrement, elementCount, elementData
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
Queue()
          Constructs a Queue instance.
 
Method Summary
 java.lang.Object get()
          Waits for an object to be pushed in the queue, and eventually returns it without removing it.
 java.lang.Object pop()
          Removes and returns the object at the top of this queue.
 void push(java.lang.Object item)
          Pushes an item at the end of this queue.
 void start()
          Authorizes the use of the queue by producers.
 void stop()
          Stops the queue by returning when it is empty and prohibiting any further producers call to the push method.
 
Methods inherited from class java.util.Vector
add, add, addAll, addAll, addElement, capacity, clear, clone, contains, containsAll, copyInto, elementAt, elements, ensureCapacity, equals, firstElement, get, hashCode, indexOf, indexOf, insertElementAt, isEmpty, lastElement, lastIndexOf, lastIndexOf, remove, remove, removeAll, removeAllElements, removeElement, removeElementAt, removeRange, retainAll, set, setElementAt, setSize, size, subList, toArray, toArray, toString, trimToSize
 
Methods inherited from class java.util.AbstractList
iterator, listIterator, listIterator
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
iterator, listIterator, listIterator
 

Constructor Detail

Queue

public Queue()
Constructs a Queue instance.

Method Detail

push

public void push(java.lang.Object item)
Pushes an item at the end of this queue.

Parameters:
item - The item to be pushed at the end of this queue.
Throws:
StoppedQueueException - If the queue is stopping or stopped.

pop

public java.lang.Object pop()
Removes and returns the object at the top of this queue.

Returns:
The object at the top of this queue.
Throws:
EmptyQueueException - If the queue is empty.

get

public java.lang.Object get()
                     throws java.lang.InterruptedException
Waits for an object to be pushed in the queue, and eventually returns it without removing it.

Returns:
The object at the top of this queue.
Throws:
java.lang.InterruptedException

start

public void start()
Authorizes the use of the queue by producers.


stop

public void stop()
          throws java.lang.InterruptedException
Stops the queue by returning when it is empty and prohibiting any further producers call to the push method.

Throws:
java.lang.InterruptedException


Copyright ? 2004 Scalagent - All rights reserved