You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by peter royal <pr...@apache.org> on 2007/02/16 21:06:56 UTC

Re: Changing the default Executor to Executors.newCachedThreadPool()

On Jan 27, 2007, at 7:02 PM, Trustin Lee wrote:
> For now, whenever default constructor of ExecutorFilter is called, new
> instance of Executor is created.  This often confuses beginners  
> because they
> see inifinitely increasing number of threads.  I admit that I made  
> a mistake
> due to my lack of knowledge on java.util.concurrent package. (What a
> lazy...! :)  Using Executors.newCachedThreadPool() could fix this  
> problem
> very easily.
>
> I'd like to apply this change to both 1.x and 2.x branch because it  
> will
> reduce users' misinterpretation significaly.  WDYT?

You mean replacing:

new ThreadPoolExecutor(16, 16, 60, TimeUnit.SECONDS, new  
LinkedBlockingQueue() )

?

(if so, that's roughly equivalent with what newCachedThreadPool does,  
just different numbers, which makes me wonder why :)

-pete

-- 
proyal@apache.org - http://fotap.org/~osi




Re: Changing the default Executor to Executors.newCachedThreadPool()

Posted by Trustin Lee <tr...@gmail.com>.
On 2/17/07, peter royal <pr...@apache.org> wrote:
> On Jan 27, 2007, at 7:02 PM, Trustin Lee wrote:
> > For now, whenever default constructor of ExecutorFilter is called, new
> > instance of Executor is created.  This often confuses beginners
> > because they
> > see inifinitely increasing number of threads.  I admit that I made
> > a mistake
> > due to my lack of knowledge on java.util.concurrent package. (What a
> > lazy...! :)  Using Executors.newCachedThreadPool() could fix this
> > problem
> > very easily.
> >
> > I'd like to apply this change to both 1.x and 2.x branch because it
> > will
> > reduce users' misinterpretation significaly.  WDYT?
>
> You mean replacing:
>
> new ThreadPoolExecutor(16, 16, 60, TimeUnit.SECONDS, new
> LinkedBlockingQueue() )
>
> ?
>
> (if so, that's roughly equivalent with what newCachedThreadPool does,
> just different numbers, which makes me wonder why :)

You are correct.  I misunderstood how ExecutorThreadModel is managed
at that moment.  (You know, that's what I wrote! :D)

Trustin
-- 
what we call human nature is actually human habit
--
http://gleamynode.net/
--
PGP Key ID: 0x0255ECA6