users@grizzly.java.net

Re: Read Timeout and Port unifcation

From: vetti07 <vetti07_at_gmail.com>
Date: Tue, 28 Jun 2016 00:28:52 -0700 (MST)

Hi Alexey,
              Thanks Alexey and I'm extremly sorry for such a late
response. Teh read timout is working now. I had the below code (extract) in
the filter with whch read timeout was having issue
        public NextAction handleRead(final FilterChainContext ctx) throws
IOException {
                             Buffer input=ctx.getMessage();
                             ReadResult<Buffer, ?> rs = null;
                              boolean isComplete=false;
                             do {
                                String line = input.toStringContent();

                                isComplete=SomeAppHandler.handleCmd(line.getBytes());
                                  
                                if(!isComplete) {
                                ReadResult<Buffer, ?> rs = ctx.read();
                                input = rs.getMessage();
                                }
                             } while(!isComplete)
           return ctx.getInvokeAction();
       }

The read timeout start working after I Changed it to
                             do {
                                String line = input.toStringContent();
                                *input.tryDispose();*

                                isComplete=SomeAppHandler.handleCmd(line.getBytes());
                                  
                                if(!isComplete) {
                                ReadResult<Buffer, ?> rs = ctx.read();
                                input = rs.getMessage();
                                *rs.recycle();*
                                }
                             } while(!isComplete)

Thanks for your help!!

Note: With updated ctx.read() is throwing exception when the connection is
getting closed. For now I'm using this to do the clean up. It would have
been wonderful if we had option to configure connection timeout (not just
read/write timeout) when using port unification for non HTTP protocols.



--
View this message in context: http://grizzly.1045725.n5.nabble.com/Read-Timeout-and-Port-unifcation-tp5711028p5711054.html
Sent from the Grizzly - Users mailing list archive at Nabble.com.