Class CometEngine

java.lang.Object
org.glassfish.grizzly.comet.CometEngine

public class CometEngine extends Object
Main class allowing Comet support on top of Grizzly Asynchronous Request Processing mechanism. This class is the entry point to any component interested to execute Comet request style. Components can be Servlets, JSP, JSF or pure Java class. A component interested to support Comet request must do:

 (1) First, register the topic on which Comet support will be applied:
     CometEngine cometEngine = CometEngine.getEngine()
     CometContext cometContext = cometEngine.register(topic)
 (2) Second, add an instance of CometHandler to the
     CometContext returned by the register method:
     CometContext.addCometHandler(org.glassfish.grizzly.comet.CometHandler<E>). Executing this operation
     will tells Grizzly to suspend the response.
 (3) Finally, you can CometContext.notify(E) other CometHandler
     to share information between CometHandler. When notified,
     CometHandler can decides to push back the data, resume the
     response, or simply ignore the content of the notification.
 
You can also select the stage where the suspension of the response happens when registering the CometContext's topic (see register(java.lang.String, int)), which can be before, during or after invoking a Servlet There is known limitation related to HTTP pipelining, it can't work properly when CometContext.isDetectClosedConnections() is enabled. So if you want to support HTTP pipelining, the closed connection detection mechanism should be disabled via CometContext.setDetectClosedConnections(boolean).
Author:
Jeanfrancois Arcand, Gustav Trede