users@grizzly.java.net

Re: Canceling connection expiration?

From: Survivant 00 <survivant00_at_gmail.com>
Date: Mon, 4 Aug 2008 07:53:35 -0400

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
>
>