How to set connection timeout

Christian Migowski chrismfwrd at gmail.com
Wed May 18 02:44:55 EDT 2011


Hi,

try

Timer timer = new HashedWheelTimer();
pipeline.addLast('timeout', new IdleStateHandler(timer, 30, 30, 0));
pipeline.addLast("ohmygod-thisisjustastringkey-icansetwhateveriwanthere",
new MyHandler());

regards,
christian


On Wed, May 18, 2011 at 3:23 AM, jsia24 <jsia18 at gmail.com> wrote:
> Hi,
>   I am using the http snoop example and making a comet server out of it, so
> the client requests and its a long running request, when there is a response
> from the server then it writes data to the connection and closes it.
> However, if the connection is idle for a particular length of time I would
> like to close it.  How can this be done in netty.  I've seen
>
> Timer timer = new HashedWheelTimer();
> pipeline.addLast('timeout', new IdleStateHandler(timer, 30, 30, 0));
> pipeline.addLast('handler', new MyHandler());
>
> but in the http snoop example it already has
> pipeline.addLast('handler', new HttpRequestHandler());
>
> so it produces an error coz I assigned 2 handlers for the parameter handler
>
> Is there a simpler way of doing this?
>
> Thanks,
> Jason
>
> --
> View this message in context: http://netty-forums-and-mailing-lists.685743.n2.nabble.com/How-to-set-connection-timeout-tp6375992p6375992.html
> Sent from the Netty User Group mailing list archive at Nabble.com.
> _______________________________________________
> netty-users mailing list
> netty-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/netty-users
>



More information about the netty-users mailing list