users@grizzly.java.net

Re: Detecting Connection closed when using ProtocolParser

From: Oleksiy Stashok <Oleksiy.Stashok_at_Sun.COM>
Date: Fri, 23 May 2008 16:56:57 +0200

Hello John,

try to extends Default or Base SelectionKeyHandler (depends which one
you're using) and override method cancel(SelectionKey) - IMHO it will
be the right place to be notified about closed connections.

WBR,
Alexey.

On May 23, 2008, at 14:30 , John ROM wrote:

> Hello,
>
> I'm testing in my code all kinds of Connection-broken situations.
>
> I have an ProtocolParser on the Client.
>
> During a lengthy read operation I just testwise kill the server.
>
> The ReadFilter then correcty reads -1 which I think
> is the NIO Way of reporting a closed Connection.
>
> Now the current selectionKey gets correctly canceled by Grizzly.
>
> Now I would somehow like to get a notice of that -1 Event but don't
> know where to hook myself in?
>
> Right now I am considering of using a second thread and
> to keep sending short messages to the server and by this detecting
> the closed connection on a write. Would that me the most elegant way?
>
> many Greetings
>
> John
>
>
>
>
>
> --
> Psssst! Schon vom neuen GMX MultiMessenger gehört?
> Der kann`s mit allen: http://www.gmx.net/de/go/multimessenger
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_grizzly.dev.java.net
> For additional commands, e-mail: users-help_at_grizzly.dev.java.net
>