mina-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From peter royal <pro...@apache.org>
Subject Re: [Mina 1.0] Question concerning SocketAcceptor creation and executors on a dual-processor server
Date Tue, 07 Nov 2006 18:22:12 GMT
On Nov 7, 2006, at 10:14 AM, Sven Panko wrote:
> After Peters remark I am still puzzled: is it better to rely on
> SocketAcceptor's default constructor (and do not specify executors/ 
> socket
> io processors at all) or can I go with this for the dual processor
> machine?
>
> --- snip start
> Executor executor = Executors.newCachedThreadPool();
> SocketAcceptor acceptor = new SocketAcceptor(2, executor);
> --- snip end
>
> --- quote start
> The above example will only use 3 threads from the pool.
> 1 for accepting, and 2 for the processing of existing connection.
> --- quote end
>
> And - just out of curiosity - why does MINA use exactly 3 threads  
> when I
> use this construct?
>
> --- snip start
> Executor executor1 = Executors.newFixedThreadPool(10);
> SocketAcceptor acceptor = new SocketAcceptor(2, executor1);
> --- snip end

the SocketAcceptor is going to use a certain number of threads, based  
on the first parameter.

The Executor is just there for it to get the threads its going to  
use. You could use a 'NewThreadExecutor()' if you don't want to worry  
about pool sizing. Its an Executor implementation that just launches  
a new thread.

-pete


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




Mime
View raw message