| java.lang.Object | |
| ↳ | com.pnfsoftware.jeb.util.collect.AsyncEventQueue<E> |
Known Direct Subclasses
|
Highly efficient, loosely bounded concurrent pseudo-queue for single-reader/multiple-writers scenarios. The implementation relies on ConcurrentLinkedQueue.
If the bound is reached, newest elements are dropped. To achieve high write efficiency and avoid
locking, the queue is loosely bounded: under certain conditions, elements may be dropped although
the queue did not reach its capacity; conversely, elements may be added although the queue
reached its capacity. To lift this uncertainty, use a bound of MAX_VALUE. The
writers should never never pull elements. Null elements are illegal.
| Public Constructors | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
|
AsyncEventQueue()
Create an unbounded queue.
| |||||||||||
|
AsyncEventQueue(int capacity)
Create a queue, optionally bounded.
| |||||||||||
| Public Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| boolean |
add(E e)
Add to the tail of the queue.
| ||||||||||
| void | clear() | ||||||||||
| boolean | isEmpty() | ||||||||||
| E |
pull()
Pull the head, unless the queue is empty, in which case null is returned.
| ||||||||||
| List<E> |
pullAll()
Pull all elements.
| ||||||||||
| List<E> | readAll() | ||||||||||
| int | size() | ||||||||||
| String | toString() | ||||||||||
|
[Expand]
Inherited Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
| |||||||||||
Create an unbounded queue.
Create a queue, optionally bounded.
Add to the tail of the queue.
| e | non-null entry to be enqueued |
|---|
Pull the head, unless the queue is empty, in which case null is returned.
Pull all elements.