java.io.Serializable
, java.lang.Iterable
, java.util.Collection
, Buffer
BlockingBuffer
, BoundedBuffer
public class SynchronizedBuffer extends SynchronizedCollection implements Buffer
Buffer
to synchronize its behaviour
for a multi-threaded environment.
Methods are synchronized, then forwarded to the decorated buffer.
This class is Serializable from Commons Collections 3.1.
collection, lock
Modifier | Constructor | Description |
---|---|---|
protected |
SynchronizedBuffer(Buffer buffer) |
Constructor that wraps (not copies).
|
protected |
SynchronizedBuffer(Buffer buffer,
java.lang.Object lock) |
Constructor that wraps (not copies).
|
Modifier and Type | Method | Description |
---|---|---|
static Buffer |
decorate(Buffer buffer) |
Factory method to create a synchronized buffer.
|
java.lang.Object |
get() |
Gets the next object from the buffer without removing it.
|
protected Buffer |
getBuffer() |
Gets the buffer being decorated.
|
java.lang.Object |
remove() |
Gets and removes the next object from the buffer.
|
add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, parallelStream, remove, removeAll, removeIf, retainAll, size, spliterator, stream, toArray, toArray
protected SynchronizedBuffer(Buffer buffer)
buffer
- the buffer to decorate, must not be nulljava.lang.IllegalArgumentException
- if the buffer is nullprotected SynchronizedBuffer(Buffer buffer, java.lang.Object lock)
buffer
- the buffer to decorate, must not be nulllock
- the lock object to use, must not be nulljava.lang.IllegalArgumentException
- if the buffer is nullpublic static Buffer decorate(Buffer buffer)
buffer
- the buffer to decorate, must not be nulljava.lang.IllegalArgumentException
- if buffer is nullprotected Buffer getBuffer()
public java.lang.Object get()
Buffer
Copyright © 2001-2017 Apache Software Foundation. All Rights Reserved.