Class DemuxingProtocolCodecFactory

java.lang.Object
org.apache.mina.filter.codec.demux.DemuxingProtocolCodecFactory
All Implemented Interfaces:
ProtocolCodecFactory

public class DemuxingProtocolCodecFactory extends Object implements ProtocolCodecFactory
A composite ProtocolCodecFactory that consists of multiple MessageEncoders and MessageDecoders. ProtocolEncoder and ProtocolDecoder this factory returns demultiplex incoming messages and buffers to appropriate MessageEncoders and MessageDecoders.

Disposing resources acquired by MessageEncoder and MessageDecoder

Make your MessageEncoder and MessageDecoder to put all resources that need to be released as a session attribute. disposeCodecResources(IoSession) method will be invoked when a session is closed. Override disposeCodecResources(IoSession) to release the resources you've put as an attribute.

We didn't provide any dispose method for MessageEncoder and MessageDecoder because they can give you a big performance penalty in case you have a lot of message types to handle.

See Also: