public abstract class DefaultConcurrentCometHandler<E> extends Object implements CometHandler<E>
Modifier and Type | Field and Description |
---|---|
protected static Logger |
logger |
protected Queue<CometEvent> |
messageQueue
todo replace with non array copying list for non resizing add situations, using internal index to keep track of
state , not a linked list, it has too much overhead and eats memory.
|
Constructor and Description |
---|
DefaultConcurrentCometHandler(CometContext<E> context,
Response response) |
DefaultConcurrentCometHandler(int messageQueueLimit) |
Modifier and Type | Method and Description |
---|---|
void |
enqueueEvent(CometEvent event)
Queues event if another thread is currently working on this handler.
|
CometContext<E> |
getCometContext() |
Response |
getResponse() |
void |
onInterrupt(CometEvent event)
Receive
CometEvent notification when the underlying tcp communication is resumed by Grizzly. |
void |
onQueueFull(CometEvent event)
Called in synchronized context when the comet handler's local event queue is full.
default impl resumes the comet handler |
void |
onTerminate(CometEvent event)
Receive
CometEvent notification when the response is resumed by a CometHandler or by the CometContext |
void |
setCometContext(CometContext<E> context) |
void |
setResponse(Response response) |
protected void |
terminate() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
onEvent, onInitialize
protected static final Logger logger
protected final Queue<CometEvent> messageQueue
public DefaultConcurrentCometHandler(CometContext<E> context, Response response)
public DefaultConcurrentCometHandler(int messageQueueLimit)
messageQueueLimit
- public CometContext<E> getCometContext()
getCometContext
in interface CometHandler<E>
public void setCometContext(CometContext<E> context)
setCometContext
in interface CometHandler<E>
public Response getResponse()
getResponse
in interface CometHandler<E>
public void setResponse(Response response)
setResponse
in interface CometHandler<E>
public void enqueueEvent(CometEvent event) throws IOException
IOException
public void onQueueFull(CometEvent event) throws IOException
event
- CometEvent
IOException
public void onInterrupt(CometEvent event) throws IOException
CometEvent
notification when the underlying tcp communication is resumed by Grizzly. This happens
when the CometContext.setExpirationDelay(long)
expires or when the remote client close the connection. onInterrupt
in interface CometHandler<E>
IOException
public void onTerminate(CometEvent event) throws IOException
CometEvent
notification when the response is resumed by a CometHandler
or by the CometContext
onTerminate
in interface CometHandler<E>
IOException
protected void terminate()
Copyright © 2015 Oracle Corporation. All rights reserved.