Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.mina.filter.codec.demux
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 `MessageEncoder`s and `MessageDecoder`s. `ProtocolEncoder` and `ProtocolDecoder` this factory returns demultiplex incoming messages and buffers to appropriate `MessageEncoder`s and `MessageDecoder`s.

## 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.

Version:
  $Rev: 612026 $, $Date: 2008-01-15 07:16:14 +0100 (Tue, 15 Jan 2008) $
Author:
  The Apache Directory Project (mina-dev@directory.apache.org)
See Also:
  `MessageEncoder`, `MessageDecoder`

Constructor Summary
`DemuxingProtocolCodecFactory()`

Method Summary
`protected void` | `disposeCodecResources(IoSession session)` Implement this method to release all resources acquired to perform encoding and decoding messages for the specified `session`.
`ProtocolDecoder` | `getDecoder()` Returns a new (or reusable) instance of `ProtocolDecoder` which decodes binary or protocol-specific data into message objects.
`ProtocolEncoder` | `getEncoder()` Returns a new (or reusable) instance of `ProtocolEncoder` which encodes message objects into binary or protocol-specific data.
`void` | `register(Class<?> encoderOrDecoderClass)`
`void` | `register(MessageDecoder decoder)`
`void` | `register(MessageDecoderFactory factory)`
`void` | `register(MessageEncoder encoder)`
`void` | `register(MessageEncoderFactory factory)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### DemuxingProtocolCodecFactory

    public DemuxingProtocolCodecFactory()

Method Detail

### register

    public void register(Class<?> encoderOrDecoderClass)

### register

    public void register(MessageEncoder encoder)

### register

    public void register(MessageEncoderFactory factory)

### register

    public void register(MessageDecoder decoder)

### register

    public void register(MessageDecoderFactory factory)

### getEncoder

    public ProtocolEncoder getEncoder()
                               throws Exception

  Description copied from interface: `ProtocolCodecFactory`
  Returns a new (or reusable) instance of `ProtocolEncoder` which encodes message objects into binary or protocol-specific data.

  Specified by:
    `getEncoder` in interface `ProtocolCodecFactory`
  Throws:
    `Exception`

### getDecoder

    public ProtocolDecoder getDecoder()
                               throws Exception

  Description copied from interface: `ProtocolCodecFactory`
  Returns a new (or reusable) instance of `ProtocolDecoder` which decodes binary or protocol-specific data into message objects.

  Specified by:
    `getDecoder` in interface `ProtocolCodecFactory`
  Throws:
    `Exception`

### disposeCodecResources

    protected void disposeCodecResources(IoSession session)

  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

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2004-2008 Apache MINA Project. All Rights Reserved.