Hi,

the codec factory expose two methods :
   public ProtocolEncoder getEncoder( IoSession session )
   public ProtocolDecoder getDecoder( IoSession session )

Usually, when designing a new codec, those methods returns a new instance of the decoder/encoder for each sessions, as these instances are stored into the user's session. In many cases (ie, when the encoding/decoding is stateless), this is useless. We should instead create unique instances of those encoder/decoder, and store the instance into the session. Even if the codec is stateful, the current codec state should not be handled within the codec, but in a separate context object.

I'm not saying that the current implementation is wrong, but I think we should stress out this in the codec documentation, in order to let the protocol developers to know about it.

--
--
cordialement, regards,
Emmanuel Lécharny
www.iktek.com
directory.apache.org


Reply via email to