[concurrency-interest] Putting tasks directly on TPE queue
joe.bowbeer at gmail.com
Fri Dec 25 14:27:56 EST 2009
Why wouldn't you want to add tasks to the queue using TPE.execute ?
As you write: accessing the queue midstream isn't supported. The getQueue
method is only provided for debugging and monitoring.
Whether your app can get away with it may depend on implementation details
of a specific revision of ThreadPoolExecutor. Search for occurrences of
workQueue, and workQueue.isEmpty() in particular, in the source code for
your chosen revision of TPE :)
On Fri, Dec 25, 2009 at 1:09 AM, Gaurav Arora <G.Arora at iontrading.com>wrote:
> I have read a few threads dating back 2007 about putting tasks directly
> on a TPE queue. The general reply (as is mentioned in the API as well) is to
> not access the queue directly. In all those threads, the corePoolSize and
> the maximumPoolSize were different. What if the core pool size is the same
> as the maximum pool size and all core threads are started before any tasks
> are submitted on the queue? Is it still a bad idea to put tasks directly on
> the queue? Can it can cause hard to track down failures?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Concurrency-interest