[concurrency-interest] ScheduledThreadPoolExecutor and shutdown permission check.
Online at stolsvik.com
Wed Apr 30 10:56:19 EDT 2008
Gregg Wonderly wrote:
> Ben Manes wrote:
>> Yes, but my point was that there may not be a need for an explicit
>> shutdown and an implicit one when the applet was stopped would solve
>> most use-cases.
> The STPE is used in a class which has hundreds of instances created and
> destroyed over the life of the applet.
While I agree to the problem you're describing (it is downright silly
that threads you been allowed to create and use shouldn't be
*controllable* by you too - I mean, what you're really asking is to have
the threads you've (implicitly) created simply exit their run()
methods), I find this specific usage you describe here somewhat strange:
Why not have one pool that these instances share? I thought a big point
of a threadpool is that thread creation and stopping is rather expensive.
> If I use daemon threads won't they still
> be parked when idle?
Yes, they should.
You could, I guess, use the timeout functionality of the TPEs, so that
they'll die after a (very short) while when the queue is empty.
More information about the Concurrency-interest