|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sun.grizzly.comet.CometContext<E>
com.sun.enterprise.web.connector.grizzly.comet.CometContext<E>
CometContext
public class 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).
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 java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected final CometEvent eventInitialize
protected final CometEvent eventInterrupt
protected final CometEvent eventTerminate
Constructor Detail |
---|
public CometContext(String contextPath, int continuationType)
Method Detail |
---|
protected void setTopic(String topic)
public int addCometHandler(CometHandler handler, boolean completeExecution)
public int addCometHandler(CometHandler handler)
public CometHandler getCometHandler(int hashCode)
CometHandler
using its based on its CometHandler#hashCode
;
getCometHandler
in class CometContext<E>
public void removeCometHandler(CometHandler handler)
public boolean removeCometHandler(int hashCode)
CometHandler
based on its hashcode. Return true
if the operation was sucessfull.
O(n) performance.
removeCometHandler
in class CometContext<E>
hashCode
- The hashcode of the CometHandler to remove.
public boolean resumeCometHandler(CometHandler handler)
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.
handler
- The CometHandler to resume.
public void notify(Object attachment) throws IOException
CometHandler
. All
CometHandler.onEvent(com.sun.grizzly.comet.CometEvent)
will be invoked with a CometEvent
of type NOTIFY.
notify
in class CometContext<E>
attachment
- An object shared amongst CometHandler
.
IOException
public boolean isActive(CometHandler cometHandler)
public void notify(Object attachment, int eventType, int cometHandlerID) throws IOException
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)
notify
in class CometContext<E>
attachment
- An object shared amongst CometHandler
.eventType
- The type of notification.cometHandlerID
- Notify a single CometHandler.
IOException
protected ConcurrentHashMap<CometHandler,CometTask> handlers()
CometHandler
handlers
in class CometContext<E>
CometHandler
protected void initialize(CometHandler handler) throws IOException
CometHandler
.
initialize
in class CometContext<E>
IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |