users@grizzly.java.net

[HEADS UP] onTerminate issue (Grizzly Comet Framework)

From: Jeanfrancois Arcand <Jeanfrancois.Arcand_at_Sun.COM>
Date: Thu, 05 Nov 2009 14:31:54 -0500

Salut,

I've just found an incompatible change made between 1.8.x and 1.9.x
related to CometHandler. If you have implemented Comet during that time,
please not that the:

   * CometHandler.onTerminate(..)

was wrongly invoked when the response was resumed. Since the invocation
was happening after the response has been resumed, and if you where
doing I/O operations inside the onTerminate, the Response was getting
corrupted and re-used by other requests.

Note that the onTerminate has never been invoked by Grizzly Comet in
Grizzly 1.0. Workaround is to invoke the
CometContext.notify(CometEvent.TERMINATE) from the onEvent method.

If you are using Grizzly Comet Framework 1.0 and plan to migrate, I
strongly recommend you take a look at Atmosphere (which is Grizzly Comet
Framework 2.0):

   * http://atmosphere.dev.java.net

Thanks!

-- Jeanfrancois