You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@directory.apache.org by ro...@jpmorgan.com on 2006/01/06 13:28:35 UTC

[MINA] Upgrading from 0.8 to 0.9 - some questions

Hi,

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?

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?).

Thanks,

Robert



This communication is for informational purposes only. It is not intended
as an offer or solicitation for the purchase or sale of any financial
instrument or as an official confirmation of any transaction. All market prices,
data and other information are not warranted as to completeness or accuracy and
are subject to change without notice. Any comments or statements made herein 
do not necessarily reflect those of JPMorgan Chase & Co., its subsidiaries 
and affiliates.

Re: [MINA] Upgrading from 0.8 to 0.9 - some questions

Posted by Trustin Lee <tr...@gmail.com>.
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 <ro...@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