[concurrency-interest] Is LinkedBlockingQueue.isEmpty() threadsafe?

Szabolcs Ferenczi szabolcs.ferenczi at gmail.com
Sun Apr 22 16:46:10 EDT 2007


On 22/04/07, Griffith, Dave <Dave.Griffith at turner.com> wrote:

> Instead of the producer calling isEmpty(), imagine a separate monitoring
> component making the call.  In high-reliability environments, _every_
> component is shadowed by a monitoring component, and certainly an obvious
> chokepoint like a queue would have health and capacity monitoring.
> Algorithmically uninteresting, but crucial in deployment.

The first guess of the esoteric group was about the producer thread
calling isEmpty() but you changed your mind. No problem. I can imaging
a lot of things but here we should be exact. Some code, please, even
if it is a pseudo code!

Would your monitoring component call isEmpty() in a busy loop or
rather occasionally, inside an `if' statement?

Best Regards,
Szabolcs


More information about the Concurrency-interest mailing list