Is there a synchronized Queue
class in Java? I'm looking for something like Vector
(which is synchronized) vs ArrayList
(which is not), but instead of implementing the List
interface, I'm looking for it to implement Queue
.
Note that there is no Collections.synchronizedQueue
method to wrap an unsynchronized queue and make it synchronized.
Look at ArrayBlockingQueue
and another BlockingQueue
implementations.
From documentation:
A Queue that additionally supports operations that wait for the queue to become non-empty when retrieving an element, and wait for space to become available in the queue when storing an element.