You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@mina.apache.org by Aleksandar Lazic <al...@none.at> on 2009/10/31 16:21:56 UTC

KeepAliveFilter questions

Dear List,

what is 'better' the

KeepAliveFilter

or in the handler the sessionIdle() method?

I have try to use the keepalive filter but I wasn't very successful ;-(

### main
KeepAliveFilter filter = new KeepAliveFilter(new
CommendKeepAliveMessageFactory());
	filter.setForwardEvent(true);
		
// Create TCP/IP connector.
NioSocketConnector connector = new NioSocketConnector();
connector.getFilterChain().addFirst("logging", new LoggingFilter());
connector.getFilterChain().addLast("keep-alive", filter);
connector.setConnectTimeoutMillis(20);
connector.setHandler(new Commend2SNAPHandler());

ConnectFuture future = connector.connect(
                        new InetSocketAddress("10.10.10.199",17000));
   future.await();
   System.out.println("fu-isConn " + future.isConnected());
   if(future.isConnected()){
    IoSession sessin = future.getSession();
   }else{
     future.cancel();
     connector.dispose();
     System.exit(0);
   }
###

attached the CommendKeepAliveMessageFactory file.

Many thanks for help.

BR

Aleks

Re: KeepAliveFilter questions

Posted by Aleksandar Lazic <al...@none.at>.
On Mon 02.11.2009 18:33, Ashish wrote:
>Can you elaborate a bit on the problem/issue you are facing?

I was falling in the trap of

session.getConfig().setIdleTime(IdleStatus.BOTH_IDLE, 10);

and

KeepAliveFilter

After I have remove the setIdleTime in the handler the filter works.

Sorry for the rush.

BR

Aleks

Re: KeepAliveFilter questions

Posted by Ashish <pa...@gmail.com>.
Can you elaborate a bit on the problem/issue you are facing?

thanks
ashish

On Sat, Oct 31, 2009 at 8:51 PM, Aleksandar Lazic <al...@none.at> wrote:
> Dear List,
>
> what is 'better' the
>
> KeepAliveFilter
>
> or in the handler the sessionIdle() method?
>
> I have try to use the keepalive filter but I wasn't very successful ;-(
>
> ### main
> KeepAliveFilter filter = new KeepAliveFilter(new
> CommendKeepAliveMessageFactory());
>        filter.setForwardEvent(true);
>
> // Create TCP/IP connector.
> NioSocketConnector connector = new NioSocketConnector();
> connector.getFilterChain().addFirst("logging", new LoggingFilter());
> connector.getFilterChain().addLast("keep-alive", filter);
> connector.setConnectTimeoutMillis(20);
> connector.setHandler(new Commend2SNAPHandler());
>
> ConnectFuture future = connector.connect(
>                       new InetSocketAddress("10.10.10.199",17000));
>  future.await();
>  System.out.println("fu-isConn " + future.isConnected());
>  if(future.isConnected()){
>   IoSession sessin = future.getSession();
>  }else{
>    future.cancel();
>    connector.dispose();
>    System.exit(0);
>  }
> ###
>
> attached the CommendKeepAliveMessageFactory file.
>
> Many thanks for help.
>
> BR
>
> Aleks



-- 
thanks
ashish

Blog: http://www.ashishpaliwal.com/blog
My Photo Galleries: http://www.pbase.com/ashishpaliwal