Hi Wolverine,

On 1/15/07, wolverine my <[EMAIL PROTECTED]> wrote:

May I know when does Mina calls MessageDecoder.decodable()?


Sishen gave you a great answer.

What is the side effect if I hardcode the decodable() to always return
MessageDecoderResult.OK?


Well, then DemuxingProtocolCodecFactory will always choose one
MessageDecoder that always returns MessageDecoderResult.OK, which makes
DemuxingProtocolCodecFactory of no use.

Looking at the Sumup example, can we move the logic in decodable() to
decode()?
Will it cause any side effect?


The side effect is described above already.  Users are supposed to put a
message header (or prefix) detection (or recognition) code in decodable(),
and to put the code that reads the actual data fields (or message body) in
decode().  This is quite a useful separation and the contract between you
and DemuxingProtocolCodecFactory.  If you don't want this kind of rule, you
don't need to use DemuxingProtocolCodecFactory.  You could just implement
your own decoder implementation.

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