[infinispan-dev] The reason(s) why we have so many threads are spawned in the testsuite
Manik Surtani
manik at jboss.org
Fri Oct 9 06:57:30 EDT 2009
On 6 Oct 2009, at 15:59, Galder Zamarreno wrote:
>
> The lazyness I was refering about earlier comes into play here in the
> sense that, why not start the TPE the 1st time we register an async
> Listener? If we did so, we'd be saving resources if no async listeners
> are enabled (This looks to me the most common case right now). I can
> see
> the point of having this ready for normal use but certainly for
> testsuite use, this is waste when we're creating so many
> CacheManagers,
> Caches instances and have several threads running different tests at
> the
> same time.
Regarding laziness, I don't think this is an issue. Let's take the
case of the DefaultExecutorFactory (and
DefaultScheduledExecutorFactory). We create the executors using the
JDK ExecutorService, passing in a ThreadFactory impl. So while we may
create the executor upfront, this is relatively lightweight (except
perhaps for the task queue, but again we use LinkedBlockingQueues
which are cheap to construct). The threads themselves to populate the
threadpool used by the executor is populated lazily (see
j.u.c.ThreadPoolExecutor#execute(), Sun JDK 6).
Cheers
--
Manik Surtani
manik at jboss.org
Lead, Infinispan
Lead, JBoss Cache
http://www.infinispan.org
http://www.jbosscache.org
More information about the infinispan-dev
mailing list