On Oct 18, 2006, at 10:07 AM, Frédéric Brégier wrote:
Just to continue on my previous mail
however, I was thinking that the SocketAcceptor
has 16 threads by default but when I look into
the code :
public SocketAcceptor()
    {
        this( 1, new NewThreadExecutor() );
    }
only one thread is used...
The default 16 threads is only for the default ExecutorFilter.

It could be something like (if Mina keep 1 thread by cpu) :
public SocketAcceptor()
    {
        int nbProc = Runtime.getRuntime().availableProcessors();
        if (nbProc == 1)
            this( 1, new NewThreadExecutor() );
        else {
            Executor executor = Executors.nexFixedThreadPool(nbProc);
            this( nbProc, executor ) ;
        }
    }

This would actually be much easier, just replace the '1' with 'Runtime.getRuntime().availableProcessors()'.

The 'NewThreadExecutor' means that the threads aren't from a pool, rather it just creates a new thread for each task submitted.

-pete


--
[EMAIL PROTECTED] - http://fotap.org/~osi



Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to