[concurrency-interest] SingleThreadExecutor

Doug Lea dl@cs.oswego.edu
Mon, 26 Jan 2004 08:17:14 -0500

> Well, you did pick a timeout for cachedThreadPool ... 

Still, singleThreadExecutor should have as simply-described a set of
properties as possible. And in practice, it will hardly matter.
Keep-alive timeouts become important only when you have peak
thread demands that are much higher than average demands, which is an
issue that arises with pools (especially of the sort you get with
newCachedThreadPool settings), not single threaded executors.  It
would be very unusual, although possible, to encounter this kind of
problem by creating huge numbers of singleThreadExecutors. And even if
people do this, and find there is a problem, they can use the manual
constructor to control keep-alive settings as needed.  More likely,
they would decide to replace all these single-threaded executors
with a single pool.

All in all, it's a marginal preference issue, but one where I think it
is just barely preferable is to keep it as it is.