Paul Clapham wrote:Yes, it's certainly possible that all of your application threads could be waiting. Did you consider that to be a potential problem? If so, why?
Jeff Verdegan wrote:
We don't sleep to give other threads a chance to run. We don't do anything to give other threads a chance to run, except maybe set threads' priorities to possibly give some desired shape to the distribution (although even that does not have well defined results). The JVM takes care of scheduling for us. The only reason you would sleep is if you want your current thread to stop working for some time, for its own reasons.
This doesn't make sense. The producer shouldn't care what the consumers are doing. That's the reason we decouple them and make it multithreaded--producing and consuming are independent tasks.
(is this a state when the JVM executes no thread(s)?).
No clue what you're saying here.
Also, why are your consumers sleeping in the first place?