fr.dyade.aaa.util
Class Queue
public class Queue
extends 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.
Queue() - Constructs a
Queue instance.
|
Object | get() - Waits for an object to be pushed in the queue, and eventually returns
it without removing it.
|
Object | pop() - Removes and returns the object at the top of this queue.
|
void | push(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.
|
Queue
public Queue()
Constructs a Queue
instance.
get
public Object get()
throws InterruptedException
Waits for an object to be pushed in the queue, and eventually returns
it without removing it.
- The object at the top of this queue.
pop
public Object pop()
Removes and returns the object at the top of this queue.
- The object at the top of this queue.
push
public void push(Object item)
Pushes an item at the end of this queue.
item
- The item to be pushed at the end of this queue.
start
public void start()
Authorizes the use of the queue by producers.
stop
public void stop()
throws InterruptedException
Stops the queue by returning when it is empty and prohibiting any
further producers call to the push
method.
Copyright B) 2004 Scalagent - All rights reserved