could you help me? Is this necessery for BlockingQueue, when I want to be sure that only one thread modify queue?:
BlockingQueue queue = new ArrayBlockingQueue(1024);
Collections=Collections.synchronizedCollection(queue); <--- is this necessary?
Since BlockingQueue is thread safe, you do not need to synchronize its accesses: the concurrency is handled by the class itself.
The BlockingQueue javadoc states:
BlockingQueue implementations are thread-safe.
It also provides a producer - consumer example.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With