You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by Holger Hoffstaette <ho...@wizards.de> on 2007/04/23 12:26:33 UTC

API suggestion: make threads & timers more pluggable

While deciding whether to write my own or stealing^h^h^h^h^h^hreusing an
existing implementation I just stumbled over Mina's ExpiringMap and saw
that it creates a new private Thread for every Map. May I suggest to make
this pluggable, e.g. by passing in/setting a ScheduledExecutorService and
not create a new Thread for every Map? SES exists for a reason and works
very well. :)

commons-pool made the same mistake and now 20 small pools needlessly
create 20 threads that are idle most of the time..

thanks
Holger



Re: API suggestion: make threads & timers more pluggable

Posted by Greg Duffy <gd...@gmail.com>.
I wrote this for MINA to provide a passable (read: replace with your own)
default implementation for IoSessionRecycler, and I admit it is not the best
in terms of extensibility. Now that we are on Java 1.5+, I think it would be
good to add in these kinds of changes in 2.0.0. As Julien suggested, please
file a JIRA issue so it will be remembered!

-Greg Duffy

On 4/23/07, Holger Hoffstaette < holger@wizards.de> wrote:
>
>
> While deciding whether to write my own or stealing^h^h^h^h^h^hreusing an
> existing implementation I just stumbled over Mina's ExpiringMap and saw
> that it creates a new private Thread for every Map. May I suggest to make
> this pluggable, e.g. by passing in/setting a ScheduledExecutorService and
> not create a new Thread for every Map? SES exists for a reason and works
> very well. :)
>
> commons-pool made the same mistake and now 20 small pools needlessly
> create 20 threads that are idle most of the time..
>
> thanks
> Holger
>
>
>

Re: API suggestion: make threads & timers more pluggable

Posted by Julien Vermillard <jv...@archean.fr>.
Le lundi 23 avril 2007 à 12:26 +0200, Holger Hoffstaette a écrit :
> While deciding whether to write my own or stealing^h^h^h^h^h^hreusing an
> existing implementation I just stumbled over Mina's ExpiringMap and saw
> that it creates a new private Thread for every Map. May I suggest to make
> this pluggable, e.g. by passing in/setting a ScheduledExecutorService and
> not create a new Thread for every Map? SES exists for a reason and works
> very well. :)
> 
> commons-pool made the same mistake and now 20 small pools needlessly
> create 20 threads that are idle most of the time..
> 
> thanks
> Holger

Really a nice suggestion, can you please fill a JIRA issue ?

Julien