|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.apache.commons.collections.collection.SynchronizedCollection | +--org.apache.commons.collections.buffer.SynchronizedBuffer | +--org.apache.commons.collections.buffer.BlockingBuffer
Decorates another Buffer
to make get()
and
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.
Field Summary |
Fields inherited from class org.apache.commons.collections.collection.SynchronizedCollection |
collection, lock |
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()
Gets the next object from the buffer without removing it. |
Object |
remove()
Gets and removes the next object from the buffer. |
Methods inherited from class org.apache.commons.collections.buffer.SynchronizedBuffer |
getBuffer |
Methods inherited from class org.apache.commons.collections.collection.SynchronizedCollection |
clear, contains, containsAll, decorate, equals, hashCode, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray, toString |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.Collection |
clear, contains, containsAll, equals, hashCode, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray |
Constructor Detail |
protected BlockingBuffer(Buffer buffer)
buffer
- the buffer to decorate, must not be null
IllegalArgumentException
- if the buffer is nullMethod Detail |
public static Buffer decorate(Buffer buffer)
buffer
- the buffer to decorate, must not be null
IllegalArgumentException
- if buffer is nullpublic boolean add(Object o)
add
in interface Collection
add
in class SynchronizedCollection
public boolean addAll(Collection c)
addAll
in interface Collection
addAll
in class SynchronizedCollection
public Object get()
Buffer
get
in interface Buffer
get
in class SynchronizedBuffer
public Object remove()
Buffer
remove
in interface Buffer
remove
in class SynchronizedBuffer
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |