|
||||||||
前のクラス 次のクラス | フレームあり フレームなし | |||||||
概要: 入れ子 | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド |
java.lang.Objectcom.nec.webotx.enterprise.web.connector.grizzly.comet.CometContext<E>
public class CometContext<E>
The main object used by CometHandler
.
The CometContext
is always available for CometHandler
and can be used to notify 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).
フィールドの概要 | |
---|---|
protected boolean |
cancelled
Is the CometContext instance been cancelled. |
protected int |
continuationType
The CometContext continuationType. |
protected static java.lang.String |
INVALID_COMET_HANDLER
Generic error message |
コンストラクタの概要 | |
---|---|
CometContext(java.lang.String contextPath,
int continuationType)
Create a new instance |
メソッドの概要 | |
---|---|
protected void |
addAsyncProcessorTask(AsyncProcessorTask asyncTask)
Add a AsyncProcessorTask . |
void |
addAttribute(java.lang.Object key,
java.lang.Object value)
Add an attibute. |
int |
addCometHandler(CometHandler handler)
Add a CometHandler . |
int |
addCometHandler(CometHandler handler,
boolean completeExecution)
Add a CometHandler . |
protected static void |
addInProgressSelectionKey(java.nio.channels.SelectionKey key)
|
protected java.util.concurrent.ConcurrentLinkedQueue<AsyncProcessorTask> |
getAsyncProcessorTask()
Return the list of AsyncProcessorTask |
java.lang.Object |
getAttribute(java.lang.Object key)
Retrive an attribute. |
CometHandler |
getCometHandler(int hashCode)
Retrive a CometHandler using its hashKey; |
protected CometHandler |
getCometHandler(java.nio.channels.SelectionKey key)
Retrive a CometHandler using its SelectionKey. |
protected CometSelector |
getCometSelector()
Get the CometSelector associated with this instance. |
java.lang.String |
getContextPath()
Get the context path associated with this instance. |
long |
getExpirationDelay()
Return the long delay before a request is resumed. |
NotificationHandler |
getNotificationHandler()
|
protected void |
initialize(java.nio.channels.SelectionKey key)
Initialize the newly added CometHandler . |
protected void |
interrupt(java.nio.channels.SelectionKey key)
Invoke CometHandler.onTerminate |
boolean |
isActive(CometHandler cometHandler)
Return true if this CometHandler is still active, e.g. there is still a continuation associated with it. |
boolean |
isBlockingNotification()
Return true if the invoker of notify() should block when notifying Comet Handlers. |
protected boolean |
isCancelled()
Is this instance beeing cancelled by the CometSelector |
protected void |
notify(CometEvent event,
int eventType,
java.nio.channels.SelectionKey key)
Notify all CometHandler . |
void |
notify(E attachment)
Notify all CometHandler . |
void |
notify(E attachment,
int eventType)
Notify all CometHandler . |
void |
notify(E attachment,
int eventType,
int cometHandlerID)
Notify a single CometHandler . |
protected void |
recycle()
Recycle this object. |
boolean |
registerAsyncRead(CometHandler handler)
Register for asynchronous read. |
boolean |
registerAsyncWrite(CometHandler handler)
Register for asynchronous write. |
java.lang.Object |
removeAttribute(java.lang.Object key)
Remove an attribute. |
void |
removeCometHandler(CometHandler handler)
Remove a CometHandler . |
void |
removeCometHandler(int hashCode)
Remove a CometHandler based on its hashcode. |
protected static boolean |
removeInProgressSelectionKey(java.nio.channels.SelectionKey key)
|
void |
resumeCometHandler(CometHandler handler)
Resume the Comet request and remove it from the active CometHandler list. |
protected void |
resumeCometHandler(CometHandler handler,
boolean remove)
Resume the Comet request. |
void |
setBlockingNotification(boolean blockingNotification)
Set to true if the invoker of notify() should block when notifying Comet Handlers. |
protected void |
setCancelled(boolean cancelled)
Cancel this object or "uncancel". |
protected void |
setCometSelector(CometSelector cometSelector)
Set the CometSelector associated with this instance. |
void |
setExpirationDelay(long expirationDelay)
Set the long delay before a request is resumed. |
void |
setNotificationHandler(NotificationHandler notificationHandler)
|
java.lang.String |
toString()
Helper. |
クラス java.lang.Object から継承されたメソッド |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
フィールドの詳細 |
---|
protected static final java.lang.String INVALID_COMET_HANDLER
protected boolean cancelled
CometContext
instance been cancelled.
protected int continuationType
CometContext
continuationType. See CometEngine
コンストラクタの詳細 |
---|
public CometContext(java.lang.String contextPath, int continuationType)
contextPath
- the context pathtype
- when the Comet processing will happen (see CometEngine).メソッドの詳細 |
---|
public java.lang.String getContextPath()
public void addAttribute(java.lang.Object key, java.lang.Object value)
key
- the keyvalue
- the valuepublic java.lang.Object getAttribute(java.lang.Object key)
key
- the key
public java.lang.Object removeAttribute(java.lang.Object key)
key
- the key
public int addCometHandler(CometHandler handler, boolean completeExecution)
CometHandler
. Client of this method might
make sure the CometHandler
is removed when the
CometHandler.onInterrupt
is invoked.
handler
- a new CometHandler
completeExecution
- Add the Comethandler but don't block waiting
for event.public int addCometHandler(CometHandler handler)
CometHandler
. Client on this method might
make sure the CometHandler
is removed when the
CometHandler.onInterrupt
is invoked.
handler
- a new CometHandler
public CometHandler getCometHandler(int hashCode)
CometHandler
using its hashKey;
protected CometHandler getCometHandler(java.nio.channels.SelectionKey key)
CometHandler
using its SelectionKey. The
SelectionKey
is not exposed to the Comet API, hence this
method must be protected.
protected void notify(CometEvent event, int eventType, java.nio.channels.SelectionKey key) throws java.io.IOException
CometHandler
. The attachment can be null.
The type
will determine which code>CometHandler
method will be invoked:
CometEvent.INTERRUPT -> CometHandler.onInterrupt
CometEvent.NOTIFY -> CometHandler.onEvent
CometEvent.INITIALIZE -> CometHandler.onInitialize
CometEvent.TERMINATE -> CometHandler.onTerminate
CometEvent.READ -> CometHandler.onEvent
CometEvent.WRITE -> CometHandler.onEvent
attachment
- An object shared amongst CometHandler
.type
- The type of notification.key
- The SelectionKey associated with the CometHandler.
java.io.IOException
public void removeCometHandler(CometHandler handler)
CometHandler
. If the continuation (connection)
associated with this CometHandler
no longer have
CometHandler
associated to it, it will be resumed.
public void removeCometHandler(int hashCode)
CometHandler
based on its hashcode.
public void resumeCometHandler(CometHandler handler)
protected void resumeCometHandler(CometHandler handler, boolean remove)
handler
- The CometHandler associated with the current continuation.remove
- true if the CometHandler needs to be removed.public boolean isActive(CometHandler cometHandler)
public void notify(E attachment) throws java.io.IOException
CometHandler
. The attachment can be null. All
CometHandler.onEvent()
will be invoked.
attachment
- An object shared amongst CometHandler
.
java.io.IOException
public void notify(E attachment, int eventType, int cometHandlerID) throws java.io.IOException
CometHandler
. The attachment can be null.
The type
will determine which CometHandler
method will be invoked:CometHandler.onInterrupt
CometHandler.onEvent
CometHandler.onInitialize
CometHandler.onTerminate
CometHandler.onEvent
attachment
- An object shared amongst CometHandler
.type
- The type of notification.cometHandlerID
- Notify a single CometHandler.
java.io.IOException
protected void initialize(java.nio.channels.SelectionKey key) throws java.io.IOException
CometHandler
.
attachment
- An object shared amongst CometHandler
.type
- The type of notification.key
- The SelectionKey representing the CometHandler.
java.io.IOException
public void notify(E attachment, int eventType) throws java.io.IOException
CometHandler
. The attachment can be null.
The type
will determine which CometHandler
method will be invoked:CometHandler.onInterrupt
CometHandler.onEvent
CometHandler.onInitialize
CometHandler.onTerminate
CometHandler.onEvent
attachment
- An object shared amongst CometHandler
.type
- The type of notification.
java.io.IOException
public boolean registerAsyncRead(CometHandler handler)
public boolean registerAsyncWrite(CometHandler handler)
protected void recycle()
protected boolean isCancelled()
CometSelector
protected void setCancelled(boolean cancelled)
cancelled
- true or false.protected void addAsyncProcessorTask(AsyncProcessorTask asyncTask)
AsyncProcessorTask
.
asyncTask
- the AsyncProcessorTask
protected java.util.concurrent.ConcurrentLinkedQueue<AsyncProcessorTask> getAsyncProcessorTask()
AsyncProcessorTask
AsyncProcessorTask
protected CometSelector getCometSelector()
CometSelector
associated with this instance.
CometSelector
associated with
this instance.protected void setCometSelector(CometSelector cometSelector)
CometSelector
associated with this instance.
CometSelector
- the CometSelector
associated with
this instance.public java.lang.String toString()
java.lang.Object
内の toString
public long getExpirationDelay()
long
delay before a request is resumed.
long
delay before a request is resumed.public void setExpirationDelay(long expirationDelay)
long
delay before a request is resumed.
long
- the long
delay before a request is resumed.protected void interrupt(java.nio.channels.SelectionKey key)
CometHandler.onTerminate
public boolean isBlockingNotification()
public void setBlockingNotification(boolean blockingNotification)
public void setNotificationHandler(NotificationHandler notificationHandler)
public NotificationHandler getNotificationHandler()
protected static void addInProgressSelectionKey(java.nio.channels.SelectionKey key)
protected static boolean removeInProgressSelectionKey(java.nio.channels.SelectionKey key)
|
||||||||
前のクラス 次のクラス | フレームあり フレームなし | |||||||
概要: 入れ子 | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド |