I have two separated blocking queues. The clients usually use either the first of the second blocking queue to retrieve elements to be processed.
In some case, the c
I came across the same problem, and ended up writing my own concurrent queue to support this usage pattern.
As Java blocking primitived don't allow to block on more than one object, the solution was pushed to the collection itself: Linked Blocking Multi Queue is actually a set set of queues connected by the heads. Elements are offered to individual "sub-queues", but retrieved from a single place (which suppors blocking operations).