users@grizzly.java.net

Re: 1.7.3.3 drop connection every 30 seconds

From: Jeanfrancois Arcand <Jeanfrancois.Arcand_at_Sun.COM>
Date: Thu, 05 Jun 2008 14:40:47 -0700

And I've replied...


Hi,

I've posted your question to the grizzly's user list:
users_at_grizzly.dev.sun.com and cc-ed you By default, Grizzly close idle
connection after 30 seconds. You can configure this number by overriding
the DefaultSelectionKeyHandler.expires() method like this:

    class SharedSelectionKeyHandler extends DefaultSelectionKeyHandler {
          @Override
          public void expire(Iterator keys) {
          } // The connections are never going
    }

Thanks!

-- Jeanfrancois

Jeanfrancois Arcand wrote:
> [From my blog]
>
> Hi Jean-Francois,
>
> I'm new to Grizzly and Java NIO. I downloaded this example and test it.
> Im impressed by how easy you can put a server on. I also slightly
> modified the client example in order to loop for a very long period of
> time and I observed some behavior that I don't know if its right. 1.
> With the latest grizzly-framework-1.7.3.3 the connection is dropped
> after 30 seconds. Even if there is activity on the channel, I got a
> java.nio.channels.ClosedChannelException while the client was trying to
> send data to the server. I tried to modify the serverTimeout,
> selectTimeout and socketTimeout on the TCPHandler but i saw no change.
> 2. I tested with the grizzly-framework-1.7.0 and there is no such
> problem as the connection is not dropped if the client is doing some
> activity. However, if no activity the connection is dropped after 30
> seconds. Could you give me some hints on how to configure the different
> timeouts? I actually need a server that keeps connections alive for very
> long perdiods of tine.
>
> Thanks.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_grizzly.dev.java.net
> For additional commands, e-mail: users-help_at_grizzly.dev.java.net
>