com.mortbay.Util
Class BlockingQueue

java.lang.Object
  |
  +--com.mortbay.Util.BlockingQueue

public class BlockingQueue
extends java.lang.Object

Blocking queue XXX temp implementation while waiting for java2 containers. Implemented as circular buffer in a Vector. Synchronization is on the vector to avoid double synchronization.

Version:
1.0 Fri May 28 1999
Author:
Greg Wilkins (gregw)

Constructor Summary
BlockingQueue(int maxSize)
          Constructor.
 
Method Summary
 java.lang.Object get()
          Get object from queue.
 java.lang.Object get(long timeout)
          Get from queue.
 int maxSize()
           
 void put(java.lang.Object o)
          Put object in queue.
 void put(java.lang.Object o, int timeout)
          Put object in queue.
 int size()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BlockingQueue

public BlockingQueue(int maxSize)
Constructor.
Method Detail

size

public int size()
Returns:
 

maxSize

public int maxSize()
Returns:
 

put

public void put(java.lang.Object o)
         throws java.lang.InterruptedException
Put object in queue.
Parameters:
o - Object

put

public void put(java.lang.Object o,
                int timeout)
         throws java.lang.InterruptedException
Put object in queue.
Parameters:
timeout - If timeout expires, throw InterruptedException
o - Object
Throws:
java.lang.InterruptedException - Timeout expired or otherwise interrupted

get

public java.lang.Object get()
                     throws java.lang.InterruptedException
Get object from queue. Block if there are no objects to get.
Returns:
The next object in the queue.

get

public java.lang.Object get(long timeout)
                     throws java.lang.InterruptedException
Get from queue. Block for timeout if there are no objects to get.
Parameters:
timeout - the time to wait for a job
Returns:
The next object in the queue, or null if timedout.