users@grizzly.java.net

Re: Registration of SelectionKeys on connection open/close in Grizzly 2.0

From: Oleksiy Stashok <Oleksiy.Stashok_at_Sun.COM>
Date: Tue, 16 Jun 2009 14:40:57 +0200

Hi Bo,

> I noticed that the ACCEPTED and CONNECTED IO events are fired AFTER
> the read
> interest is registered with the selector. This makes it impossible to
> initialize some connection related state before processing data on
> the new
> connection. Is it possible to move the selector registration after
> firing
> the IO events?
you're right ACCEPTED and CONNECTED events are fired AFTER read
interest registration, but BEFORE any data will be processed on the
connection. If you observe different behavior, it could be bug.
And unfortunately selector registration should happen before ACCEPTED
and CONNECTED events will be fired, cause at that time Connection
should be 100% ready for use.

>
> Another thing, when closing a connection, the READ interest is not
> deregistered from the selector and another READ IO event is fired.
> This
> eventually leads to an EOFException or ClosedChannelException. Is
> this a
> bug?
Do you see this exception? I though it should be hidden by framework :)
If you see it in stacktrace - it's bug, if not - it's ok :)

Thank you.

WBR,
Alexey.

>
> Thanks again
> Bo
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_grizzly.dev.java.net
> For additional commands, e-mail: users-help_at_grizzly.dev.java.net
>