users@grizzly.java.net

Re: comet handler interrupted

From: Jeanfrancois Arcand <Jeanfrancois.Arcand_at_Sun.COM>
Date: Wed, 02 Jul 2008 10:45:44 -0400

Salut,

Cam Bazz wrote:
> Hello,
>
> My cometized app is almost working. I made a jquery loop, with a long
> timeout, and upon success the method recalls itself.
>
> in the comet-counter example both onEvent and onInterrupt methods had
> the same code (incrementing the counter)
>
> previously, I thought the onInterrupt method was for when something went
> wrong so the client could be notified, and clean the resources.

Not the client, but your CometHandler. If the browser close the
connection, Grizzly will call that onInterrupt() method.


>
> what happens is, onEvent and onInterrupt is called in an alternating
> fashion,
>
> so first it fires onEvent, then onInterrupt, then onEvent again and so on.

onInterrupt will be called only once. After that, the CometHandler.onXXX
will never get re-invoked as the CometHandler removed from the events
queue. As soon as onInterrupt gets called, onEvent() will never be
called again.

Thanks

-- Jeanfrancois


>
> I was returning an interrupted flag to my client if in case something
> went wrong.
>
> Any ideas?
>
> Best,