directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Trustin Lee <trus...@gmail.com>
Subject Re: [MINA] Upgrading from 0.8 to 0.9 - some questions
Date Wed, 18 Jan 2006 02:16:09 GMT
Hi Robert,

I'm sorry for such a slow response.  I was busy for looking for a new job.

2006/1/6, robert.j.greig@jpmorgan.com <robert.j.greig@jpmorgan.com>:
>
> We have been using MINA very successfully in an application and I am
> looking to upgrade to version 0.9.
>
> We were using the old ProtocolHandler and the DemuxingProtocolCodecFactory
> and I'm trying to understand how this works in the new version.
>
> Here are my specific questions:
>
> 1. Looking at the SumUp example, I'm not sure what the following lines do:
>
> // Create I/O and Protocol thread pool filter.
> // I/O thread pool performs encoding and decoding of messages.
> // Protocol thread pool performs actual protocol flow.
> ThreadPoolFilter ioThreadPoolFilter = new ThreadPoolFilter();
> ThreadPoolFilter protocolThreadPoolFilter = new ThreadPoolFilter();
> IoConnector connector = new SocketConnector();
> connector.getFilterChain().addFirst(
>           "ioThreadPool", ioThreadPoolFilter );
>           connector.getFilterChain().addLast(
>           "protocolThreadPool", protocolThreadPoolFilter );
>
> In the ClientSessionHandler, I can see this:
>
> session.getFilterChain().addLast("protocolFilter", new
> ProtocolCodecFilter(
> codec ) );
>
> But I am not sure how the session filter chain relates to the connection
> filter chain.
>
> What is the responsibility of each of the thread pool filters?


I/O layer and protocol layer has been merged.  This means there's no
distinction between them.  In 0.9 examples, only one thread pool filter is
inserted.  You can add another IoThreadPool after ProtocolCodecFilter to
emulate the same behavior with 0.8.

2. How is the DemuxingIoHandler supposed to be used? Presumably the output
> from a ProtocolCodecFilter can be hooked up to it but I'm not clear how
> that works (if it were an IoFilter I could see that I could add it to the
> end of the chain?).


If you register a pair of a message type (java.lang.Class) and a
MessageHandler which processes the message type, then DemuxingIoHandler
demultiplexes appropriate messageReceived events to the appropriate
MessageHandler (using Class.isAssignableFrom()).

Please let me know my answer doesn't clarify your questions.  I'll try to
answer again to your more specific questions.

HTH,
Trustin
--
what we call human nature is actually human habit
--
http://gleamynode.net/
PGP Key ID: 0x854B996C

Mime
View raw message