On May 2, 2006, at 4:12 AM, Frederic Soulier wrote:
And the decoders you have for each message are not necessarily MINA's decoders, right?
They do implement MINA's Decoder interface for convenience.
If I follow you correctly:- A CumulativeProtocolDecoder just keep requesting more data until it has at least a full message in buffer (or more).- This decoder class has a table indicating: msg type 1 use my own decoder class AAA msg type 2 use my own decoder class BBB ... msg type x use my own decoder class ZZZ- In the doDecode method (we know we have a full message of some sort) we check the type of the message and we have a decoder for that type (we hope so otherwise it's an invalid type of message) we call the appropriate decoder to decode the message and return a message object that ultimately will passed back to the IoHandler messageReceived method.
exactly!
If that's how it works I suspect I have to be careful with the decoder table and decoders as as far as I understand each IoSession has it's own instance of the filters so I don't really want to have a Decoder in the filter chain that needs to instantiate all these secondary decoders which should be the same for all clients connecting really.Is an IoSession per connection?
An IoSession is per-connection, but IoFilters aren't necessarily. You can add the ProtocolDecoderFilter to the template filter chain for your connection, and the same instance will be re-used. Make your ProtocolCodecFactory return the the same ProtocolDecoder each time, and you can avoid having unnecessary instantiation.
-pete -- [EMAIL PROTECTED] - http://fotap.org/~osi
smime.p7s
Description: S/MIME cryptographic signature
