|
A common need, when dealing with multiple threads, is for a thread-safe
coordinated queue into which you can place items of work, and from which a pool
of threads can pick up those items of work and process them.
This is such a common need that Java 5 (and beyond) now provides such a set
of queues.
All these queues implement the interface java.util.concurrent.BlockingQueue,
or java.util.concurrent.BlockingDeque
(for a double-ended queue version).
The queues implemented in the package java.util.concurrent
include:
ArrayBlockingQueue -- A bounded blocking
queue backed by an array.
LinkedBlockingQueue -- An optionally-bounded
blocking queue based on linked nodes.
LinkedBlockingDeque -- An optionally-bounded
blocking deque based on linked nodes.
PriorityBlockingQueue -- An unbounded
blocking queue that uses the same ordering rules as class PriorityQueue
and supplies blocking retrieval operations.
DelayQueue -- An unbounded blocking queue of
Delayed elements, in which an element can only be taken when
its delay has expired.
|