Class DemuxingProtocolCodecFactory
java.lang.Object
org.apache.mina.filter.codec.demux.DemuxingProtocolCodecFactory
- All Implemented Interfaces:
ProtocolCodecFactory
A composite Disposing resources acquired by
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:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voiddisposeCodecResources(IoSession session) Implement this method to release all resources acquired to perform encoding and decoding messages for the specified session.Returns a new (or reusable) instance ofProtocolDecoderwhich decodes binary or protocol-specific data into message objects.Returns a new (or reusable) instance ofProtocolEncoderwhich encodes message objects into binary or protocol-specific data.voidvoidregister(MessageDecoder decoder) voidregister(MessageDecoderFactory factory) voidregister(MessageEncoder encoder) voidregister(MessageEncoderFactory factory)
-
Constructor Details
-
DemuxingProtocolCodecFactory
public DemuxingProtocolCodecFactory()
-
-
Method Details
-
register
-
register
-
register
-
register
-
register
-
getEncoder
Description copied from interface:ProtocolCodecFactoryReturns a new (or reusable) instance ofProtocolEncoderwhich encodes message objects into binary or protocol-specific data.- Specified by:
getEncoderin interfaceProtocolCodecFactory- Throws:
Exception
-
getDecoder
Description copied from interface:ProtocolCodecFactoryReturns a new (or reusable) instance ofProtocolDecoderwhich decodes binary or protocol-specific data into message objects.- Specified by:
getDecoderin interfaceProtocolCodecFactory- Throws:
Exception
-
disposeCodecResources
Implement this method to release all resources acquired to perform encoding and decoding messages for the specified session. By default, this method does nothing.- Parameters:
session- the session that requires resource deallocation now
-