Maarten Bosteels wrote: > Hi Niklas, > > I am reading the mina mailing list since about a year, but this is the > first time I see a recommendation to keep the ProtocolDecoder > implemantation stateless. > I prefer to create a new decoder per session and keep the decoder > state in the decode. > Sound OO-principle says : store the state in the class that uses it.
Maybe stateless was the wrong word here. There's nothing wrong with storing state in your ProtocolDecoder implementation. As long as it isn't per-session state. Even if that will work in MINA 1.0 I guess that could change in future versions. AFAIK there's nothing in the docs that tells you that MINA 1.0 creates one decoder per session, right? You would have to look at the ProcolCodecFilter code. I think that if this is something users do and expect to work we need to enforce this rule (one decoder instance per session) somehow to prevent incompatibilities later on. At least document it thoroughly. > > Should I really anticipate that mina will someday no longer support > statefull decoders ? No, you shouldn't. :-) I'm just saying that AFAIK there's really nothing that says that it works that way and at the moment you cannot expect it not to change in the future. It's great that you're raising the issue because if this is what users want we need to make sure it stays that way. -- Niklas Therning www.spamdrain.net
