Hi Frederic, Thank you very much for your detailed explanation. I still have 3 questions, could you please help to give more details?
> For SocketAcceptor (or IoAcceptor) : > Executor executor1 = Executors.newFixedThreadPool(nbThread); > SocketAcceptor acceptor = new SocketAcceptor(nbThread, executor1); > 1) Is there any relationship between "Number of processing threads" (in constructor of SocketAccepter) and "thread-pool's size" (in function newFixedThreadPool)? In your example, they would be the same, right? > For SocketAcceptorConfig (or IoAcceptorConfig), in order to > be able to specify my own Thread Pool Filter: > SockectAccaptorConfig config = new SocketAcceptorConfig(); > config.setThreadModel(ThreadModel.MANUAL); 2) If I set the fixed number of threads, do I need to set the ThreadModel for the SocketAcceptorConfig as your direction? I think that when we set the MANUAL model, that means we created the thread-pools ourselves, no need the MINA to take care? Please advice me. 3) From MINA 1.x, there is only one thread-pool is used instead of "IoThreadPoolFilter & ProtocolThreadPoolFilter" (mina 0.8.x), right? I need to be clarify because I am migrating my software from 0.8.x to 1.0 but in the past it used 2 configured parameters to set thread-pool's size. Please help me too. Thanks. I don't understand much about the "filter chain"... or something related, I hope I could take time to investigate this function of MINA soon. Hope they are not so hard to learn. Thanks & best regards, Hieu Phan. > -----Original Message----- > From: Frédéric Brégier [mailto:[EMAIL PROTECTED] > Sent: Wednesday, October 11, 2006 7:09 PM > To: [email protected] > Subject: Re: [MINA 1.x] IoThreadPoolFilter & ProtocolThreadPoolFilter > > It is only my own experience, but here is my way to set > Thread Pool for several part of Mina in 1.0 : > > For SocketAcceptor (or IoAcceptor) : > Executor executor1 = Executors.newFixedThreadPool(nbThread); > SocketAcceptor acceptor = new SocketAcceptor(nbThread, executor1); > > My feeling is that it shouldn't be a newCachedThreadPool here since > it seems it is relative to the number of SocketIoProcessors that > the SocketAcceptor will use. > By default (new SocketAcceptor() without arguments), it use > a value of 16 threads and SocketIoProcessors. > > For SocketAcceptorConfig (or IoAcceptorConfig), in order to > be able to specify my own Thread Pool Filter: > SockectAccaptorConfig config = new SocketAcceptorConfig(); > config.setThreadModel(ThreadModel.MANUAL); > > Then for the filter chain (example here is for compression) : > IoFilterChain chain = config.getFilterChain(); > > Executor executor2 = Executors.newCachedThreadPool(); > chain.addLast( "compressionPool", > new ExecutorFilter( new ExecutorExecutor( executor2 ) ) ); > chain.addLast( "compression", compressionFilter); > > And so on for any Filters that could be expensive in cpu... > > chain.addLast( "otherPool", > new ExecutorFilter( new ExecutorExecutor( > Executors.newCachedThreadPool() ) ) ); > chain.addLast( "other", other); > > You can use also newFixedThreadPool instead of > newCachedThreadPool as you want here for FilterChain. > > Hope this helps you. > Frederic
