com.ibm.ulc.util
Class UnboundedBuffer

java.lang.Object
  |
  +--com.ibm.ulc.util.UnboundedBuffer

public class UnboundedBuffer
extends java.lang.Object
implements java.io.Serializable

An unbounded buffer. Taking an item from an empty buffer blocks the caller until it is non-empty. Putting an item never blocks the caller.

See Also:
Serialized Form

Field Summary
protected  java.util.Vector fArray
           
 
Constructor Summary
UnboundedBuffer()
          Constructs an unbounded buffer with the given capacity.
 
Method Summary
 int length()
          Length of queue.
 void put(java.lang.Object x)
          Puts an object into the buffer with the given capacity.
 java.lang.Object take(long timeout)
          Takes an object from the queue.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

fArray

protected java.util.Vector fArray
Constructor Detail

UnboundedBuffer

public UnboundedBuffer()
Constructs an unbounded buffer with the given capacity.
Method Detail

length

public int length()
Length of queue.

put

public void put(java.lang.Object x)
Puts an object into the buffer with the given capacity.

take

public java.lang.Object take(long timeout)
Takes an object from the queue. When empty the caller is blocked until it is non-empty or a timeout accured.