# Class: com.pnfsoftware.jeb.util.collect.AsyncEventQueue

Highly efficient, loosely bounded concurrent pseudo\-queue for single\-reader/multiple\-writers scenarios. The implementation relies on [ConcurrentLinkedQueue](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 [Integer#MAX_VALUE](Integer#MAX_VALUE). The writers should never never pull elements. Null elements are illegal.

## Constructor: AsyncEventQueue

Description: Create an unbounded queue.

## Constructor: AsyncEventQueue
- parameter: `capacity`, type: `int`

Description: Create a queue, optionally bounded.
parameter: capacity: maximum queue capacity

## Method: add
- parameter: `e`, type: `E`
- return type: `boolean`

Description: Add to the tail of the queue.
parameter: e: non\-null entry to be enqueued
return: true if the element was added, false if it was dropped

## Method: clear

Description: Remove all queued elements.

## Method: isEmpty
- return type: `boolean`

Description: Determine whether the queue is empty.
return: true if the queue is empty

## Method: pull
- return type: `E`

Description: Pull the head, unless the queue is empty, in which case null is returned.  

 Implementation note: this method must not be used by producers; its use is reserved for the single consumer.
return: the head or null

## Method: pullAll
- return type: `java.util.List<E>`

Description: Pull all elements.
return: pulled elements

## Method: readAll
- return type: `java.util.List<E>`

Description: Read all elements without clearing the queue.
return: copy of queued elements

## Method: size
- return type: `int`

Description: Get the approximate queue size.
return: current queue size

## Method: toString
- return type: `java.lang.String`


