dev@grizzly.java.net

Re: handling SelectionKey.OP_ACCEPT without invoking a chain of filters added in Transport.

From: ming qin <mingqin1_at_yahoo.com>
Date: Fri, 18 Dec 2009 13:43:20 -0800 (PST)

    test shows the handleAccept method in both EchoFilter and TransportFilter  are executed , regardless of  boolean value assigned to isInterested
        filterChain.setInterested(IOEvent.SERVER_ACCEPT, boolean: isInterested );

   I also tested  filterChain.setInterested(IOEVent.READ, boolean:isInterested) by adding a line in EchoServer.java as filterChain.setInterested(IOEvent.READ, false),  handleRead method in both EchoFilter and TransportFilter  are executed , regardless of  boolean value assigned to isInterested.

  Below are code snippets for this test:
   In com.sun.grizzly.sample.echo. EchoSever.java ,  I added two lines to get a filterChain a           transport.getFilterChain().add(new TransportFilter());         transport.getFilterChain().add(new EchoFilter());         // below two lines for no executions on filters ( EchoFilter and    Trasnportfilter)  // when IOEvent .SEVER_ACCEPT occurs         FilterChain filterChain = transport.getFilterChain();         filterChain.setInterested(IOEvent.SERVER_ACCEPT, false);  

    
  

Ming Qin
Cell Phone 858-353-2839

--- On Thu, 12/17/09, Oleksiy Stashok <Oleksiy.Stashok_at_Sun.COM> wrote:

From: Oleksiy Stashok <Oleksiy.Stashok_at_Sun.COM>
Subject: Re: handling SelectionKey.OP_ACCEPT without invoking a chain of filters added in Transport.
To: dev_at_grizzly.dev.java.net
Date: Thursday, December 17, 2009, 1:58 AM

Hi Ming Qin,
please tryfilterChain.setInterested(IOEvent.SERVER_ACCEPT, false);
WBR,Alexey.
On Dec 17, 2009, at 8:37 , ming qin wrote:
 For Grizzly 2.0.0-M3, after SelectionKey.OP_ACCEPT ‘s  firing IOEvent.SERVER_ACCEPT , can SelectorRunner not to invoke a chain of filters being defined in Transport? Transport is added with a series   filters as a chain of filters.   when client requests a connection with server,  the server’s SelectorRunner invokes fire(key, IOEvent.SERVER_ACCEPT), as well as those filters being added in Transport are invoked.
By avoiding invoking those filters in transport for SelectionKey.OP_ACCEPT,SelectionKey.OP_ACCEPT related ready-operation should run on a fast track, if there are no datai is supposed to pass into those filters.


Ming Qin
Cell Phone 858-353-2839