Hi,

I've seen through the examples different ways to place filters. Which way do you would advice?


way 1)

public class ReverseProtocolHandler extends IoHandlerAdapter
{
    private static IoFilter LOGGING_FILTER = new LoggingFilter();
    private static IoFilter CODEC_FILTER =
        new ProtocolCodecFilter( new TextLineCodecFactory() );

    public void sessionCreated( IoSession session ) throws Exception
    {
        session.getFilterChain().addLast( "logger", LOGGING_FILTER );
        session.getFilterChain().addLast( "codec", CODEC_FILTER );
    }


way 2)

        IoAcceptor tAcceptor = new SocketAcceptor();
        IoAcceptorConfig tConfig = new SocketAcceptorConfig();
        DefaultIoFilterChainBuilder tChain = tConfig.getFilterChain();
        tChain.addLast( "logger", new LoggingFilter() );


Regards
Michael

Reply via email to