mina-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Bauroth <Michael.Baur...@falcom.de>
Subject Which is the advice for correct filter placement?
Date Tue, 28 Mar 2006 21:41:05 GMT
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

Mime
View raw message