FileDocCategorySizeDatePackage
Queue.javaAPI DocGlassfish v2 API3445Fri May 04 22:32:58 BST 2007org.apache.jasper.util

Queue

public class Queue extends Object
A simple FIFO queue class which causes the calling thread to wait if the queue is empty and notifies threads that are waiting when it is not empty.
author
Anil V (akv@eng.sun.com)

Fields Summary
private Vector
vector
Constructors Summary
Methods Summary
public synchronized java.lang.Objectget()
Get the first object out of the queue. Return null if the queue is empty.

	Object object = peek();
	if (object != null)
	    vector.removeElementAt(0);
	return object;
    
public booleanisEmpty()
Is the queue empty?

	return vector.isEmpty();
    
public java.lang.Objectpeek()
Peek to see if something is available.

	if (isEmpty())
	    return null;
	return vector.elementAt(0);
    
public synchronized java.lang.Objectpull()
Pull the first object out of the queue. Wait if the queue is empty.

	while (isEmpty())
	    try {
		wait();
	    } catch (InterruptedException ex) {
	    }
	return get();
    
public synchronized voidput(java.lang.Object object)
Put the object into the queue.

param
object the object to be appended to the queue.


             			       				      
         
	vector.addElement(object);
	notify();
    
public intsize()
How many elements are there in this queue?

	return vector.size();