users@grizzly.java.net

Re: expose ThreadPoolExecutor's BlockingQueue in DefaultThreadPool?

From: Jeanfrancois Arcand <Jeanfrancois.Arcand_at_Sun.COM>
Date: Thu, 14 May 2009 11:26:07 -0400

Salut,

John Franey wrote:
>
> I have a change request for the interface of DefaultThreadPool. Should
> I post as issue?

yes. Attach a svn diff -u if you have something you want us to look at.

>
> I would like to use a different BlockingQueue than what is currently
> hardwired and unchangeable (LInkedBlockingQueue).

Should we change the queue directly inside that class?

>
> My main reason is to reduce memory allocation rate. A
> LinkedBlockingQueue$Node object is allocated for every entry in the
> LinkedBlockingQueue. I'd like to use an ArrayBlockingQueue instead, to
> avoid allocating the Node objects.

I need to look a the code, but I suspect the queue needs to be
synchronized IMO. Again, I need to look :-)

>
> SelectorHandlerRunner cancels the key on unexpected exceptions, which
> seems to be the right thing for the case when the thread pool's execute
> throws a RejectedExecutionRejection, basically shutting down connections
> for which there isn't capacity.

Can you elaborate? You think switching the queue will reduce the memory
allocation under that specific scenario?

Thanks!

--Jeanfrancois


>
> Regards,
> John
>