The codecfactory in the tutorial is stateless : http://mina.apache.org/tutorial-on-protocolcodecfilter-for-mina-2x.html
And stateful <-> stateless decoder was discussed here: http://www.nabble.com/Tutorial-on-ProtocolCodecFilter%2C-state-and-threads-td11254694.html regards, Maarten On Mon, Mar 30, 2009 at 9:52 AM, Julien Vermillard <[email protected]> wrote: > Le Sun, 29 Mar 2009 12:14:05 +0200, > Emmanuel Lecharny <[email protected]> a écrit : > >> 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. >> > I thought it was clear , but you are right, that need more > documentation (stateless vs statefull codec) > Julien >
