First of all, Frederic and Peter, thanks for your detailed explanation!

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

Sven



peter royal <[EMAIL PROTECTED]> wrote on 07.11.2006 16:54:53:

> On Nov 7, 2006, at 3:43 AM, Frederic Soulier wrote:
> > Example:
> >   Executor executor1 = Executors.newFixedThreadPool(10);
> >   SocketAcceptor acceptor = new SocketAcceptor(2, executor1);
> > will setup 2 SocketIoProcessors sharing a thread pool of 10 threads.
> > If you have more than 10 clients connecting and sending/receiving 
> > at the
> > same time you may have pbms hence why depending on the intent of your
> > app it may be better to use:
> 
> actually, not exactly..
> 
> the Executor parameter to the SocketAcceptor merely provides a source 
> for threads. The above example will only use 3 threads from the pool. 
> 1 for accepting, and 2 for the processing of existing connection. 
> (The constructor that takes an Executor was added for people that are 
> integrating MINA into larger systems that want to centralize thread 
> creation for the entire application)
> 
> I think you may be thinking of the ExecutorFilter, which does bring 
> the performance implications you mention.
> 
> -pete
> 
> 
> -- 
> [EMAIL PROTECTED] - http://fotap.org/~osi
> 
> 
> 



Information contained in this message is confidential and may be legally 
privileged. If you are not the addressee indicated in this message (or 
responsible for the delivery of the message to such person), you may not copy, 
disclose or deliver this message or any part of it to anyone, in any form. In 
such case, you should delete this message and kindly notify the sender by reply 
Email. Opinions, conclusions and other information in this message that do not 
relate to the official business of Proximity shall be understood as neither 
given nor endorsed by it.

Reply via email to