You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by James Im <im...@hotmail.com> on 2007/01/15 18:38:05 UTC

Architecture: IoFilter chain vs ProtocolCodecFilter

In the doc there is a file called "Architecture.vsd" that present 2 ways
of building a protocol with mina.

you have to choice to use IoFilters or use a ProtocolCodecFilter.

I don't know why I should choose one over the other. I believe that I
could implement my server either way.

So my questions are:

Is the performance of one better than the other?
Which architecture do you prefer/use? why?

_________________________________________________________________
Download din yndlingsmusik pĺ MSN Music:  http://www.msn.dk/music  - det er 
nemt og billigt


Re: Architecture: IoFilter chain vs ProtocolCodecFilter

Posted by "Steven E. Harris" <se...@panix.com>.
James Im <im...@hotmail.com> writes:

> Which architecture do you prefer/use? why?

Though I'm working on a client, I'll still chime in. The
ProtocolCodecFilter just formalizes a particular intention of a filter
-- reshaping the type of the message, with symmetric translation "in"
or "out". The ProtocolCodecFilter is an implementation of an IoFilter
that delegates more specific and relevant calls to your encoder and
decoder. Using it makes the protocol-specific code's purpose more
obvious.

Also, at least on the decoding side, the ProtocolCodecFilter can be
plugged together with some helpful implementations like
CumulativeProtocolDecoder and TextLineDecoder.

-- 
Steven E. Harris