com.sun.enterprise.web.connector.grizzly.comet
Class CometEngine

java.lang.Object
  extended by com.sun.grizzly.comet.CometEngine
      extended by com.sun.enterprise.web.connector.grizzly.comet.CometEngine

Deprecated. - Use CometEngine

public class CometEngine
extends CometEngine

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 cometContext path on which Comet support will be applied: CometEngine cometEngine = CometEngine.getEngine() CometContext cometContext = cometEngine.register(contextPath) (2) Second, add an instance of CometHandler to the CometContext returned by the register method: cometContext.addCometHandler(handler); (3) Finally, you can invokeCometHandler other CometHandler by doing: cometContext.invokeCometHandler(Object)(handler); You can also select the stage where the request polling happens when registering the cometContext path (see register(String,int);

Author:
Jeanfrancois Arcand

Field Summary
protected static CometEngine cometEngine
          Deprecated.  
 
Fields inherited from class com.sun.grizzly.comet.CometEngine
activeContexts, AFTER_RESPONSE_PROCESSING, AFTER_SERVLET_PROCESSING, BEFORE_REQUEST_PROCESSING, cometContextCache, DISABLE_CLIENT_DISCONNECTION_DETECTION, DISABLE_SUSPEND_TIMEOUT, logger, threadPool, updatedContexts
 
Constructor Summary
CometEngine()
          Deprecated.  
 
Method Summary
protected  void flushPostExecute(CometTask task, boolean finishExecution)
          Deprecated. Ensures ProcessorTask is recycled and that SelectionKey is canceled when needed.
 CometContext getCometContext(String contextPath)
          Deprecated. Return the CometContext associated with the topic.
static CometEngine getEngine()
          Deprecated. 
protected  boolean interrupt(CometTask task, boolean finishExecution)
          Deprecated. Interrupt a CometHandler by invoking CometHandler.onInterrupt(com.sun.grizzly.comet.CometEvent)
protected  boolean interrupt(CometTask task, boolean finishExecution)
          Deprecated. Interrupt a CometHandler by invoking CometHandler.onInterrupt(com.sun.enterprise.web.connector.grizzly.comet.CometEvent)
protected  void interrupt0(CometTask task, boolean finishExecution)
          Deprecated. interrupt logic in its own method, so it can be executed either async or sync.
cometHandler.onInterrupt is performed async due to its functionality is unknown, hence not safe to run in the performance critical selector thread.
 CometContext register(String contextPath)
          Deprecated. Register a context path with this CometEngine.
 CometContext register(String topic, int type)
          Deprecated. Register a context path with this CometEngine.
 
Methods inherited from class com.sun.grizzly.comet.CometEngine
getThreadPool, handle, isCometEnabled, logger, register, setThreadPool, unregister
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

cometEngine

protected static final CometEngine cometEngine
Deprecated. 
Constructor Detail

CometEngine

public CometEngine()
Deprecated. 
Method Detail

getEngine

public static CometEngine getEngine()
Deprecated. 


register

public CometContext register(String contextPath)
Deprecated. 
Register a context path with this CometEngine. The CometContext returned will be of type AFTER_SERVLET_PROCESSING, which means the request target (most probably a Servlet) will be executed first and then polled.

Overrides:
register in class CometEngine
Parameters:
contextPath - the context path used to create the CometContext
Returns:
CometContext a configured CometContext.

register

public CometContext register(String topic,
                             int type)
Deprecated. 
Register a context path with this CometEngine. The CometContext returned will be of type type.

Overrides:
register in class CometEngine
Parameters:
topic - the context path used to create the CometContext
type - when the request will be suspended, e.g. CometEngine.BEFORE_REQUEST_PROCESSING, CometEngine.AFTER_SERVLET_PROCESSING or CometEngine.AFTER_RESPONSE_PROCESSING
Returns:
CometContext a configured CometContext.

getCometContext

public CometContext getCometContext(String contextPath)
Deprecated. 
Return the CometContext associated with the topic.

Overrides:
getCometContext in class CometEngine
Parameters:
contextPath - the topic used to creates the CometContext

interrupt

protected boolean interrupt(CometTask task,
                            boolean finishExecution)
Deprecated. 
Description copied from class: CometEngine
Interrupt a CometHandler by invoking CometHandler.onInterrupt(com.sun.grizzly.comet.CometEvent)

Overrides:
interrupt in class CometEngine
Parameters:
task - The CometTask encapsulating the suspended connection.
finishExecution - Finish the current execution.

flushPostExecute

protected void flushPostExecute(CometTask task,
                                boolean finishExecution)
Deprecated. 
Description copied from class: CometEngine
Ensures ProcessorTask is recycled and that SelectionKey is canceled when needed.

Overrides:
flushPostExecute in class CometEngine
Parameters:
task -
aptflush -
cancelkey -

interrupt

protected boolean interrupt(CometTask task,
                            boolean finishExecution)
Deprecated. 
Interrupt a CometHandler by invoking CometHandler.onInterrupt(com.sun.enterprise.web.connector.grizzly.comet.CometEvent)


interrupt0

protected void interrupt0(CometTask task,
                          boolean finishExecution)
Deprecated. 
interrupt logic in its own method, so it can be executed either async or sync.
cometHandler.onInterrupt is performed async due to its functionality is unknown, hence not safe to run in the performance critical selector thread.

Overrides:
interrupt0 in class CometEngine
Parameters:
task - The CometTask encapsulating the suspended connection.
finishExecution - Finish the current execution.


Copyright © 2012 Oracle Corporation. All Rights Reserved.