Class BlockingBuffer
java.lang.Object
org.apache.commons.collections.collection.SynchronizedCollection
org.apache.commons.collections.buffer.SynchronizedBuffer
org.apache.commons.collections.buffer.BlockingBuffer
- All Implemented Interfaces:
Serializable,Iterable,Collection,Buffer
Deprecated.
Apache Commons Collections version 3.x is being deprecated from AEMaaCS. The upgraded version 4.4 of Commons Collections is already included as replacement. Customers are advised to upgrade to this version of the library. Please note: the package name was changed to org.apache.commons.collections4. Further note that there are AEM APIs currently exposing the old collections classes; these will be updated in upcoming releases.
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.
- Since:
- Commons Collections 3.0
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionbooleanDeprecated.booleanaddAll(Collection c) Deprecated.static BufferDeprecated.Factory method to create a blocking buffer.static BufferDeprecated.Factory method to create a blocking buffer with a timeout value.get()Deprecated.Gets the next value from the buffer, waiting until an object is added if the buffer is empty.get(long timeout) Deprecated.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.remove()Deprecated.Removes the next value from the buffer, waiting until an object is added if the buffer is empty.remove(long timeout) Deprecated.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.Methods inherited from class org.apache.commons.collections.collection.SynchronizedCollection
clear, contains, containsAll, decorate, equals, hashCode, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray, toStringMethods inherited from interface java.util.Collection
clear, contains, containsAll, equals, hashCode, isEmpty, iterator, parallelStream, remove, removeAll, removeIf, retainAll, size, spliterator, stream, toArray, toArray, toArray
-
Method Details
-
decorate
Deprecated.Factory method to create a blocking buffer.- Parameters:
buffer- the buffer to decorate, must not be null- Returns:
- a new blocking Buffer
- Throws:
IllegalArgumentException- if buffer is null
-
decorate
Deprecated.Factory method to create a blocking buffer with a timeout value.- Parameters:
buffer- the buffer to decorate, must not be nulltimeoutMillis- the timeout value in milliseconds, zero or less for no timeout- Returns:
- a new blocking buffer
- Throws:
IllegalArgumentException- if the buffer is null- Since:
- Commons Collections 3.2
-
add
Deprecated.- Specified by:
addin interfaceCollection- Overrides:
addin classSynchronizedCollection
-
addAll
Deprecated.- Specified by:
addAllin interfaceCollection- Overrides:
addAllin classSynchronizedCollection
-
get
Deprecated.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.- Specified by:
getin interfaceBuffer- Overrides:
getin classSynchronizedBuffer- Returns:
- the next object in the buffer, which is not removed
- Throws:
BufferUnderflowException- if an interrupt is received
-
get
Deprecated.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.- Parameters:
timeout- the timeout value in milliseconds- Throws:
BufferUnderflowException- if an interrupt is receivedBufferUnderflowException- if the timeout expires- Since:
- Commons Collections 3.2
-
remove
Deprecated.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.- Specified by:
removein interfaceBuffer- Overrides:
removein classSynchronizedBuffer- Returns:
- the next object in the buffer, which is also removed
- Throws:
BufferUnderflowException- if an interrupt is received
-
remove
Deprecated.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.- Parameters:
timeout- the timeout value in milliseconds- Throws:
BufferUnderflowException- if an interrupt is receivedBufferUnderflowException- if the timeout expires- Since:
- Commons Collections 3.2
-