[concurrency-interest] Queue.add() vs Executor.exec()

Gregg Wonderly gregg at cytetech.com
Fri Jan 19 16:30:26 EST 2007

A couple of different times now, I've found myself coding queue.add() for a 
queue owned by a ThreadPoolExecutor() instead of invoking an appropriate 
ThreadPoolExecutor.exec(), etc. method.  This causes nothing to run, and it is a 
bit frustrating to track down.  Historically, I guess part of the problem is 
that the pooled executors I've used/written have only had one object and for 
some reason by brain is making be consider the queue the similar object.

It seems that if the core thread pool size is non-zero that the associated 
number of threads would be running and prepared to take whatever was put onto 
the queue.

Is there a good reason why it doesn't work in this way?

Gregg Wonderly

More information about the Concurrency-interest mailing list