Le 1/28/13 9:00 PM, Julien Vermillard a écrit : > Hi, > I committed a new idea for the codec API. > It's quite radical change but I think it's a valuable improvement. > > Key here is simplicity : > - a codec module independent of the core module, could be reused for mina > 2, plain old IO, whatever So far, so good. > - a codec in compounded of a statefull decoder and an encoder Does those encoder/decoder have to be stateful ? In some case, we may wan to use a stateless decoder, because we don't want to store some state into it.
I'd rather let the user decide if his/her codec is stateless or stateful (and handle the consequences). (I do think that most of the case, a stateless decoder is needed). > - each session will store a encoder and a decoder If we use stateless decoder, there is no need to store the encoder/decoder in the session, just to make them available. The way it's currently done (pushing a reference to the encoder/decoder instances into the session attributes) is costly, and memory consuming (as you have to access the hashmap everytime you need to access the codec, and you create a <ref, codec> in every session. I would rather default to something that store a reference in the IoHandler, with the optional option to store the codec in the session. The IoSession.getEncoder/Decoder() methods will handle different cases. > > I updated the HTTP codec but not the LDAP codec. I need to take care of > make it compiling soon. Forget about the ldap codec. It has to be completely refactored anyway. I'll do it. -- Regards, Cordialement, Emmanuel Lécharny www.iktek.com
