The separation between IoHandler and protocol codec loses its meaning if
IoHandler takes care of the codec's state.  That's why I don't want
IoHandler affect any state of decoder or encoder.  And as I mentioned, the
state of the decoder might not change immediately in case that there's a
thread pool filter between the protocolcodecfilter and IoHandler.

My suggestion is still to provide a switchable encoder/decoder.
TokenSelectorStream in ANTLR shows a nice example regarding this pattern:

http://www.antlr.org/doc/streams.html#lexerstates

For example:

SwitchableProtocolDecoder d = new SwitchableProtocolDecoder();
d.register("default", new DefaultProtocolDecoder());
d.register("attachment", new AttachmentDecoder());
d.push("default");

...
if (timeToDecodeAttachment) d.push("attachment");
...
if (finishedDecodingAttachment) d.pop();
...

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