Hi Peter,

On 1/16/07, peter ellis <[EMAIL PROTECTED]> wrote:

Actually Ive stumbled across a class which basically has its own
ThreadExecutor....quite simply this class knows nothing about mina and
works in this fashion as i  understand it...

An event (of some sort) hits the EventsManager Class and delegates the
event to a thread...

resulting in the following...

private ExecutorService eventDispatcher =
Executors.newFixedThreadPool(3, new DispatcherThreadFactory());


//then there is a staic class declare within the ManagerClass

   static class DispatcherThreadFactory implements ThreadFactory {

       private int THREAD_COUNT = 0;

       public Thread newThread(Runnable runnable) {
           return new Thread(runnable, "NotificationEventDispatcher-"
+ THREAD_COUNT++);
       }
   }


Most of the rest of the code uses the listener/observer pattern so
there are a number of clients registered and and dealt with by the
thread pool!

after speaking with one of the C++ developers he advises me that as
there is a thread pool block of code there then it might be doing all
this stuff anyway meaning you dont need to add anything to mina i.e. i
dont need to add...

acceptor.getDefaultConfig().setThreadModel(ThreadModel.MANUAL);
acceptor.getFilterChainBuilder().addLast("...", new ExecutorFilter(....));

????

Silly question but what would this give me if I did add it to my
MinaXMLServer class!?


If your server is already using it's own event dispatcher thread pool, you
won't need to add any thread pool in MINA-side.  By default, MINA 1.0 adds
one thread pool, so you have to disable it:

acceptor.getDefaultConfig().setThreadModel(ThreadModel.MANUAL);

That's all. :)

HTH,
Trustin
--
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

Reply via email to