com.sun.enterprise.web.connector.grizzly.comet
Class CometContext<E>

java.lang.Object
  extended by com.sun.grizzly.comet.CometContext<E>
      extended by com.sun.enterprise.web.connector.grizzly.comet.CometContext<E>

Deprecated. use CometContext

public class CometContext<E>
extends CometContext<E>

The main object used by CometHandler. The CometContext is always available for CometHandler and can be used to invokeCometHandler other CometHandler. Attributes can be added/removed the same way HttpServletSession is doing. It is not recommended to use attributes if this CometContext is not shared amongs multiple context path (uses HttpServletSession instead).

Author:
Jeanfrancois Arcand

Field Summary
protected  CometEvent eventInitialize
          Deprecated.  
protected  CometEvent eventInterrupt
          Deprecated.  
protected  CometEvent eventTerminate
          Deprecated.  
 
Fields inherited from class com.sun.grizzly.comet.CometContext
ALREADY_REMOVED, blockingNotification, continuationType, handlers, INVALID_COMET_HANDLER, logger, notificationHandler, topic
 
Constructor Summary
CometContext(String contextPath, int continuationType)
          Deprecated. 
 
Method Summary
 int addCometHandler(CometHandler handler)
          Deprecated. 
 int addCometHandler(CometHandler handler, boolean completeExecution)
          Deprecated. 
 CometHandler getCometHandler(int hashCode)
          Deprecated. Retrieve a CometHandler using its based on its CometHandler#hashCode;
protected  ConcurrentHashMap<CometHandler,CometTask> handlers()
          Deprecated. Return the internal list of active CometHandler
protected  void initialize(CometHandler handler)
          Deprecated. Initialize the newly added CometHandler.
 boolean isActive(CometHandler cometHandler)
          Deprecated. 
 void notify(Object attachment)
          Deprecated. Notify all CometHandler.
 void notify(Object attachment, int eventType, int cometHandlerID)
          Deprecated. Notify a single CometHandler.
 void removeCometHandler(CometHandler handler)
          Deprecated. 
 boolean removeCometHandler(int hashCode)
          Deprecated. Remove a CometHandler based on its hashcode.
 boolean resumeCometHandler(CometHandler handler)
          Deprecated. Resume the Comet request and remove it from the active CometHandler list.
protected  void setTopic(String topic)
          Deprecated.  
 
Methods inherited from class com.sun.grizzly.comet.CometContext
addActiveHandler, addAttribute, addCometHandler, addCometHandler, getAttribute, getCometHandlers, getContextPath, getExpirationDelay, getNotificationHandler, getTopic, invokeCometHandler, isActive, isBlockingNotification, notify, notify, notify, recycle, registerAsyncRead, registerAsyncWrite, removeAttribute, removeCometHandler, removeCometHandler, resetSuspendIdleTimeout, resumeCometHandler, setBlockingNotification, setExpirationDelay, setNotificationHandler, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

eventInitialize

protected final CometEvent eventInitialize
Deprecated. 

eventInterrupt

protected final CometEvent eventInterrupt
Deprecated. 

eventTerminate

protected final CometEvent eventTerminate
Deprecated. 
Constructor Detail

CometContext

public CometContext(String contextPath,
                    int continuationType)
Deprecated. 

Method Detail

setTopic

protected void setTopic(String topic)
Deprecated. 

addCometHandler

public int addCometHandler(CometHandler handler,
                           boolean completeExecution)
Deprecated. 


addCometHandler

public int addCometHandler(CometHandler handler)
Deprecated. 


getCometHandler

public CometHandler getCometHandler(int hashCode)
Deprecated. 
Retrieve a CometHandler using its based on its CometHandler#hashCode;

Overrides:
getCometHandler in class CometContext<E>

removeCometHandler

public void removeCometHandler(CometHandler handler)
Deprecated. 


removeCometHandler

public boolean removeCometHandler(int hashCode)
Deprecated. 
Remove a CometHandler based on its hashcode. Return true if the operation was sucessfull. O(n) performance.

Overrides:
removeCometHandler in class CometContext<E>
Parameters:
hashCode - The hashcode of the CometHandler to remove.
Returns:
true if the operation succeeded.

resumeCometHandler

public boolean resumeCometHandler(CometHandler handler)
Deprecated. 
Resume the Comet request and remove it from the active CometHandler list. Once resumed, a CometHandler must never manipulate the HttpServletRequest or HttpServletResponse as those object will be recycled and may be re-used to serve another request. If you cache them for later reuse by another thread there is a possibility to introduce corrupted responses next time a request is made.

Parameters:
handler - The CometHandler to resume.
Returns:
true if the operation succeeded.

notify

public void notify(Object attachment)
            throws IOException
Deprecated. 
Notify all CometHandler. All CometHandler.onEvent(com.sun.grizzly.comet.CometEvent) will be invoked with a CometEvent of type NOTIFY.

Overrides:
notify in class CometContext<E>
Parameters:
attachment - An object shared amongst CometHandler.
Throws:
IOException

isActive

public boolean isActive(CometHandler cometHandler)
Deprecated. 


notify

public void notify(Object attachment,
                   int eventType,
                   int cometHandlerID)
            throws IOException
Deprecated. 
Notify a single CometHandler. The CometEvent.getType() will determine which CometHandler method will be invoked:

 CometEvent.INTERRUPT -> CometHandler.onInterrupt(com.sun.grizzly.comet.CometEvent)
 CometEvent.NOTIFY -> CometHandler.onEvent(com.sun.grizzly.comet.CometEvent)
 CometEvent.INITIALIZE -> CometHandler.onInitialize(com.sun.grizzly.comet.CometEvent)
 CometEvent.TERMINATE -> CometHandler.onTerminate(com.sun.grizzly.comet.CometEvent)
 CometEvent.READ -> CometHandler.onEvent(com.sun.grizzly.comet.CometEvent)
 

Overrides:
notify in class CometContext<E>
Parameters:
attachment - An object shared amongst CometHandler.
eventType - The type of notification.
cometHandlerID - Notify a single CometHandler.
Throws:
IOException

handlers

protected ConcurrentHashMap<CometHandler,CometTask> handlers()
Deprecated. 
Return the internal list of active CometHandler

Overrides:
handlers in class CometContext<E>
Returns:
Return the internal list of active CometHandler

initialize

protected void initialize(CometHandler handler)
                   throws IOException
Deprecated. 
Initialize the newly added CometHandler.

Overrides:
initialize in class CometContext<E>
Throws:
IOException


Copyright © 2012 Oracle Corporation. All Rights Reserved.