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 and Description |
---|---|
protected |
SynchronizedBuffer(Buffer buffer)
Constructor that wraps (not copies).
|
protected |
SynchronizedBuffer(Buffer buffer,
Object lock)
Constructor that wraps (not copies).
|
Modifier and Type | Method and Description |
---|---|
static Buffer |
decorate(Buffer buffer)
Factory method to create a synchronized buffer.
|
Object |
get()
Gets the next object from the buffer without removing it.
|
protected Buffer |
getBuffer()
Gets the buffer being decorated.
|
Object |
remove()
Gets and removes the next object from the buffer.
|
add, addAll, clear, contains, containsAll, decorate, equals, hashCode, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray, toString
protected SynchronizedBuffer(Buffer buffer)
buffer
- the buffer to decorate, must not be nullIllegalArgumentException
- if the buffer is nullprotected SynchronizedBuffer(Buffer buffer, Object lock)
buffer
- the buffer to decorate, must not be nulllock
- the lock object to use, must not be nullIllegalArgumentException
- if the buffer is nullpublic static Buffer decorate(Buffer buffer)
buffer
- the buffer to decorate, must not be nullIllegalArgumentException
- if buffer is nullprotected Buffer getBuffer()
public Object get()
Buffer
Copyright © 2001–2015 The Apache Software Foundation. All rights reserved.