users@grizzly.java.net

Re: Question about close notification implementation

From: Jeanfrancois Arcand <Jeanfrancois.Arcand_at_Sun.COM>
Date: Wed, 26 Nov 2008 12:10:57 -0500

Salut,

Survivant 00 wrote:
> JF, can you answer this one ?

Sure. You can always cc the submitter (his java.net id) works as a relay
for his normal email.

>
> How is this feature implemented?
> Do you report a local connection close event when someone requests the
> socket to close,

like I said in the [ann] email, when the remote client close the
connection, ConnectionCloseHandler.remotlyClosed() will be invoked
*first*, then locallyClosed() will follow. When the framework detect a
remote connection closed, it always make sure the SelectionKey is
finished properly and eventually invoke SelectionKeyHandler.close().
That's the reason why locallyClosed is always invoked after remotlyClosed.

  and report a remote connection close event when you get
> an exception during a read?

That doesn't make a difference in the code. When a remote connection is
closed, two things could happens:

(1) I/O operations return -1 (read/write)
(2) I/O operations throws IOException (Win32)

in both case the remotlyClosed() will be called.

Does that help?

A+

-- Jeanfrancois


>
>
>
> ---------- Forwarded message ----------
> From: ** <foo_at_bar.com <mailto:foo_at_bar.com>>
> Date: 2008/11/26
> Subject: [Sebastien Dionne's Blog] New Comment Posted to 'Grizzly : How
> to be notify when a client disconnect'
> To: survivant00_at_gmail.com <mailto:survivant00_at_gmail.com>
>
>
> A new comment has been posted on your blog Sebastien Dionne&#39;s Blog,
> on entry #10801 (Grizzly : How to be notify when a client disconnect).
>
>
> View this comment:
> <http://weblogs.java.net/blog/survivant/archive/2008/11/grizzly_how_to.html>
> Edit this comment:
> <http://weblogs.java.net/mt/mt.cgi?__mode=view&blog_id=474&_type=comment&id=52119
> <http://weblogs.java.net/mt/mt.cgi?__mode=view&blog_id=474&_type=comment&id=52119>>
>
> IP Address: 64.125.132.43 <http://64.125.132.43>
> Name: heaththegreat
> Email Address: foo_at_bar.com <mailto:foo_at_bar.com>
> URL:
> Comments:
>
> How is this feature implemented?
> Do you report a local connection close event when someone requests the
> socket to close, and report a remote connection close event when you get
> an exception during a read?
>
> --
> Powered by Movable Type
> Version 3.01D
> http://www.movabletype.org/
>
>