Tuesday, 27 August 2013

BlockingQueues and thread access order

BlockingQueues and thread access order

I have a situation where multiple threads will be polling a single
BlockingQueue by calling take(). What I want to know is the following:
If multiple threads are waiting for the queue to receive an item, will
they be given priority for taking items off the queue in the order that
they made their calls to take() or will the order in which the threads
take things off the queue be arbitrary?
Thanks!
Note: I have written my own implementations for this kind of thing in the
past, but I'm wondering if the BlockingQueue implementations in Java would
do this for me.

No comments:

Post a Comment