Java -BlockingQueue -- Multiple producers, single consumer
blockingqueue, java, multithreading
Solution
Does that mean that I can pass a single reference to a blocking queue to all producers who can drop Events in willy-nilly to be consumed by a single consumer, and nothing gets disrupted?
In a word, yes. This is safe. To quote the documentation:
`BlockingQueue` implementations are thread-safe. All queuing methods achieve their effects atomically using internal locks or other forms of concurrency control.
Problem
Quick clarification please I know `BlockingQueues` are threadsafe. Does that mean that I can pass a single reference to a blocking queue to all producers who can drop Events in willy-nilly to be consumed by a single consumer, and nothing gets disrupted? Otherwise having to produce up to 20 `BlockingQueues` that may or may not have regular updates and reading them with any efficiency seems an insurmountable task.