directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Trustin Lee <>
Subject Re: [mina] Can I use thread pool?
Date Tue, 03 Jan 2006 09:54:45 GMT

2006/1/2, ZakSSaL <>:
> I want to make a socket server program and will use mina 0.8.2.
> I want to use thread pool(one thread per client connection).
> I want that thread pool has fixed size(ex. 5 threads in a pool or max 5
> threads in a pool).
> How can I do that on mina 0.8.2?

You don't need thread-per-socket model anymore because MINA uses
asynchronous, event-driven model.  This means less than 5 threads are
required to handle 5 connections.

You can add thread pool filter by yourself:

IoAcceptor acceptor = ...
acceptor.getFilterChain().addFirst( "threadPoolFilter", new
IoThreadPoolFilter() );

Or you can use SimpleServiceRegistry as examples do.  It automatically adds
the thread pool filter internally.

You can configure the maximum number of threads by calling
IoThreadPoolFilter.setMaximumThreads() method. (Please correct me if I
remember incorrectly.)

what we call human nature is actually human habit
PGP Key ID: 0x854B996C

View raw message