Alexey helped me to refocus on something I tried before I started this
thread, but because of some other issue in my code it didn't work at
that time.
The answer I was looking for is:
public boolean doFilter(AsyncExecutor asyncExecutor) {
....
task.getSelectionKey().cancel();
....
}
If you do this, you must make sure that you handle client aborts and
other nice things on your own.
Thanks Alexey!
/i
On Aug 4, 2008, at 4:53 AM, Survivant 00 wrote:
> you can use BaseSelectionKeyHandler that doesn't expired.
>
> like this
>
> tcpSelectorHandler.setSelectionKeyHandler(new
> BaseSelectionKeyHandler());
>
> if it's what you want
>
>
> 2008/8/4 Oleksiy Stashok <Oleksiy.Stashok_at_sun.com>
> 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
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_grizzly.dev.java.net
> For additional commands, e-mail: users-help_at_grizzly.dev.java.net
>
>