A bounded {@linkplain BlockingQueue blocking queue} backed by anarray. This queue orders elements FIFO (first-in-first-out). The
head of the queue is that element that has been on the queue the longest time. The
tail of the queue is that element that has been on the queue the shortest time. New elements are inserted at the tail of the queue, and the queue retrieval operations obtain elements at the head of the queue.
This is a classic "bounded buffer", in which a fixed-sized array holds elements inserted by producers and extracted by consumers. Once created, the capacity cannot be changed. Attempts to {@code put} an element into a full queuewill result in the operation blocking; attempts to {@code take} anelement from an empty queue will similarly block.
This class supports an optional fairness policy for ordering waiting producer and consumer threads. By default, this ordering is not guaranteed. However, a queue constructed with fairness set to {@code true} grants threads access in FIFO order. Fairnessgenerally decreases throughput but reduces variability and avoids starvation.
This class and its iterator implement all of the optional methods of the {@link Collection} and {@link Iterator} interfaces.
This class is a member of the Java Collections Framework.
@since 1.5
@author Doug Lea
@param < E> the type of elements held in this collection