org.apache.commons.collections.buffer
public class BlockingBuffer extends SynchronizedBuffer
Buffer to make {@link #get()} and
{@link #remove()} block when the Buffer is empty.
If either get or remove is called on an empty
Buffer, the calling thread waits for notification that
an add or addAll operation has completed.
When one or more entries are added to an empty Buffer,
all threads blocked in get or remove are notified.
There is no guarantee that concurrent blocked get or
remove requests will be "unblocked" and receive data in the
order that they arrive.
This class is Serializable from Commons Collections 3.1.
Since: Commons Collections 3.0
Version: $Revision: 1.7 $ $Date: 2004/06/03 22:02:13 $
| Constructor Summary | |
|---|---|
| protected | BlockingBuffer(Buffer buffer)
Constructor that wraps (not copies).
|
| Method Summary | |
|---|---|
| boolean | add(Object o) |
| boolean | addAll(Collection c) |
| static Buffer | decorate(Buffer buffer)
Factory method to create a blocking buffer.
|
| Object | get() |
| Object | remove() |
Parameters: buffer the buffer to decorate, must not be null
Throws: IllegalArgumentException if the buffer is null
Parameters: buffer the buffer to decorate, must not be null
Returns: a new blocking Buffer
Throws: IllegalArgumentException if buffer is null