It is my pleasure ! It is my small feedback for all my long questions... I suggest that it could be integrated (adapted and/or corrected) in the doc, either in faq or in api doc, since this kind of question could be asked again and again. Is could be also part of a small doc to help users to migrate from 0.9.x to 1.x... Regards, Frederic ----- Original Message ----- From: "Trustin Lee" <[EMAIL PROTECTED]> To: <[email protected]> Sent: Thursday, October 12, 2006 7:05 AM Subject: Re: [MINA 1.x] IoThreadPoolFilter & ProtocolThreadPoolFilter
Thank you Frederic for the detailed instruction! I really appreciate it! Regards, Trustin On 10/11/06, Frédéric Brégier <[EMAIL PROTECTED]> wrote: > > 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 > -- what we call human nature is actually human habit -- http://gleamynode.net/ -- PGP key fingerprints: * E167 E6AF E73A CBCE EE41 4A29 544D DE48 FE95 4E7E * B693 628E 6047 4F8F CFA4 455E 1C62 A7DC 0255 ECA6
