Steven Rodeo wrote:Thanks a bunch for the replies. Will setting the fairness to true help in any way ?.
Do you mean fairness setting of
ArrayBlockingQueue in the scenario I've proposed? I don't think it would change anything in your case. As I understand it, the fairness setting is assured in every instance of the queue individually, not among multiple queues.
If there are more items in multiple queues, nothing actually guarantees that some of the thread would be given precedence simply by chance and other consumers could lag behind them. If you want to make sure this won't happen, you'll have to coordinate the consumers among themselves somehow. I cannot think of anything from the top of my head, but
you should study
java.util.concurrent package thoroughly. There are many very useful classes that you could employ.