users@grizzly.java.net

Re: Canceling connection expiration?

From: Oleksiy Stashok <Oleksiy.Stashok_at_Sun.COM>
Date: Mon, 04 Aug 2008 13:48:23 +0200

Hi Igor,

if you can share your code - it could help.
Basically to prevent key expiration - you'll need to set custom
SelectionKeyHandler on SelectorHandler.

Thanks.

WBR,
Alexey.

On Aug 4, 2008, at 6:30 , Igor Minar wrote:

> Heya,
>
> It looks like I have actually quite a few questions about Grizzly. :-)
>
> I stumbled upon a similar issue that was discussed here: http://www.nabble.com/1.7.3.3-drop-connection-every-30-seconds-td17674241.html
>
> The difference is that I'm extending Grizzly via an async filter
> that I'd like to use with Glassfish. My filter streams a lot of data
> to the client and when it's done streaming it will close the
> connection.
>
> The problem I have is that if the data transfer to the client takes
> longer than 30 seconds, the SocketChannel gets closed by the
> SelectorThread and I receive:
>
> java.nio.channels.AsynchronousCloseException
> at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:
> 312)
> at MyTask.doTask(SendfileTask.java:78)
> at
> com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:
> 265)
> at
> com
> .sun
> .enterprise
> .web.connector.grizzly.WorkerThreadImpl.run(WorkerThreadImpl.java:116)
>
>
> or
>
> java.nio.channels.ClosedChannelException
> at
> sun.nio.ch.SocketChannelImpl.ensureWriteOpen(SocketChannelImpl.java:
> 125)
> at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:
> 294)
> at MyTask.doTask(SendfileTask.java:79)
> at
> com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:
> 265)
> at
> com
> .sun
> .enterprise
> .web.connector.grizzly.WorkerThreadImpl.run(WorkerThreadImpl.java:116)
>
>
> How can I prevent the channel from being closed? I don't want to
> modify the timeout that would affect all the connections (only some
> requests are being processed by the filter). I'm not quite sure if
> it would be better to cancel the expiration for these connections
> altogether, or just set the value to something really high. At this
> point, whatever gets me going will be fine for now.
>
>
> cheers,
> Igor
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_grizzly.dev.java.net
> For additional commands, e-mail: users-help_at_grizzly.dev.java.net
>