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. This class contains an extra field in 3.2, however the serialization specification will handle this gracefully.
[Expand]
Inherited Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
org.apache.commons.collections.collection.SynchronizedCollection
|
Protected Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Constructor that wraps (not copies).
| |||||||||||
Constructor that wraps (not copies).
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Factory method to create a blocking buffer with a timeout value.
| |||||||||||
Factory method to create a blocking buffer.
| |||||||||||
Gets the next value from the buffer, waiting until an object is
added for up to the specified timeout value if the buffer is empty.
| |||||||||||
Gets the next value from the buffer, waiting until an object is
added if the buffer is empty.
| |||||||||||
Removes the next value from the buffer, waiting until an object is
added if the buffer is empty.
| |||||||||||
Removes the next value from the buffer, waiting until an object is
added for up to the specified timeout value if the buffer is empty.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
org.apache.commons.collections.buffer.SynchronizedBuffer
| |||||||||||
From class
org.apache.commons.collections.collection.SynchronizedCollection
| |||||||||||
From class
java.lang.Object
| |||||||||||
From interface
java.lang.Iterable
| |||||||||||
From interface
java.util.Collection
| |||||||||||
From interface
org.apache.commons.collections.Buffer
|
Constructor that wraps (not copies).
buffer | the buffer to decorate, must not be null |
---|
IllegalArgumentException | if the buffer is null |
---|
Constructor that wraps (not copies).
buffer | the buffer to decorate, must not be null |
---|---|
timeoutMillis | the timeout value in milliseconds, zero or less for no timeout |
IllegalArgumentException | if the buffer is null |
---|
Factory method to create a blocking buffer with a timeout value.
buffer | the buffer to decorate, must not be null |
---|---|
timeoutMillis | the timeout value in milliseconds, zero or less for no timeout |
IllegalArgumentException | if the buffer is null |
---|
Factory method to create a blocking buffer.
buffer | the buffer to decorate, must not be null |
---|
IllegalArgumentException | if buffer is null |
---|
Gets the next value from the buffer, waiting until an object is added for up to the specified timeout value if the buffer is empty.
timeout | the timeout value in milliseconds |
---|
BufferUnderflowException | if an interrupt is received |
---|---|
BufferUnderflowException | if the timeout expires |
Gets the next value from the buffer, waiting until an object is added if the buffer is empty. This method uses the default timeout set in the constructor.
BufferUnderflowException | if an interrupt is received |
---|
Removes the next value from the buffer, waiting until an object is added if the buffer is empty. This method uses the default timeout set in the constructor.
BufferUnderflowException | if an interrupt is received |
---|
Removes the next value from the buffer, waiting until an object is added for up to the specified timeout value if the buffer is empty.
timeout | the timeout value in milliseconds |
---|
BufferUnderflowException | if an interrupt is received |
---|---|
BufferUnderflowException | if the timeout expires |