Maarten Bosteels wrote:
The codecfactory in the tutorial is stateless :
http://mina.apache.org/tutorial-on-protocolcodecfilter-for-mina-2x.html
Well, if you create new instances of encoder/decoder per session, it doesn't matter too much that the factory is stateless or not. In fact, the factory being statefull or stateless is irrelevant. It's the encoder/decoder state which is important. As soon as you have new instances of those guys for each new session, and as soon as you have a guarantee that you can't enter the encoder/decoder in two different threads for the same session, then you are safe.

FWIK, if you encoder/decoder are stateless, you should never instanciate them for each session. If they are statefull, then again, you have to think about the consequences. I don't think it's a good idea to design a stateful codec by storing data into the encoder/decoder. I would rather store those data in a context object, stores within the session. This is what we do for the LDAP protocol. So at the end of the day, I don't think it make any sense to instanciate encoder/decoder at all ...

Thanks Marteen for the pointers !

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


Reply via email to