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
|
|
|
|
|
|