|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.sun.grizzly.Context
public class Context
This Object is used to share information between the Grizzly Framework classes and ProtocolFilter implementation.
| Nested Class Summary | |
|---|---|
static class |
Context.AttributeScope
|
static class |
Context.KeyRegistrationState
A SelectionKey's registration state. |
static class |
Context.OpType
The list of possible SelectionKey.OP_XXXX. |
| Field Summary | |
|---|---|
static String |
THROWABLE
Constant 'throwable' String |
| Constructor Summary | |
|---|---|
Context()
Constructor |
|
| Method Summary | |
|---|---|
protected void |
configureOpType(SelectionKey key)
Configure the currentOpType based on the
SelectionKey.readyOps() values. |
void |
copyTo(Copyable copy)
Copies current object content to copy object |
void |
execute()
Deprecated. |
void |
execute(ContextTask contextTask)
Execute this Context using the Controller's Pipeline |
void |
execute(ContextTask contextTask,
boolean runInSeparateThread)
Execute this Context using either Controller's Pipeline or current thread |
AsyncQueueReadable |
getAsyncQueueReadable()
Returns AsyncQueueReadable, assciated with the current
Context. |
protected AsyncQueueReader |
getAsyncQueueReader()
Return the AsyncQueueReader |
AsyncQueueWritable |
getAsyncQueueWritable()
Returns AsyncQueueWritable, assciated with the current
Context. |
protected AsyncQueueWriter |
getAsyncQueueWriter()
Return the AsyncQueueWriter |
Object |
getAttribute(String key)
Return an object based on a key. |
AttributeHolder |
getAttributeHolderByScope(Context.AttributeScope scope)
Return AttributeHolder, which corresponds to the
given AttributeScope |
Map<String,Object> |
getAttributes()
Return a Map of attribute name/value pairs. |
Controller |
getController()
Return the current Controller. |
Context.OpType |
getCurrentOpType()
Get the current SelectionKey interest ops this instance is executing. |
protected IOEvent |
getIOEvent()
Return the current IOEvent associated with this
instance. |
Context.KeyRegistrationState |
getKeyRegistrationState()
Return SelectionKey's next registration state. |
Pipeline |
getPipeline()
Return the Pipeline executing this instance. |
Controller.Protocol |
getProtocol()
Return the current Controller.Protocol this instance is executing. |
ProtocolChain |
getProtocolChain()
Return ProtocolChain executed by this instance. |
ProtocolChainInstanceHandler |
getProtocolChainInstanceHandler()
Return the ProtocolChainInstanceListener associated with this
Context |
SelectionKey |
getSelectionKey()
Return the current SelectionKey. |
SelectorHandler |
getSelectorHandler()
Return the current SelectorHandler this instance is executing. |
void |
recycle()
Recycle this instance. |
Object |
removeAttribute(String key)
Remove a key/value object. |
protected void |
setAsyncQueueReader(AsyncQueueReader asyncQueueReader)
Set the AsyncQueueReader |
protected void |
setAsyncQueueWriter(AsyncQueueWriter asyncQueueWriter)
Set the AsyncQueueWriter |
void |
setAttribute(String key,
Object value)
Set a key/value object. |
void |
setAttributes(Map<String,Object> attributes)
Set a Map of attribute name/value pairs. |
void |
setController(Controller controller)
Set the current Controller. |
void |
setCurrentOpType(Context.OpType currentOpType)
Set the current OpType value. |
protected void |
setIOEvent(IOEvent<Context> ioEvent)
Set an optional CallbackHandler. |
void |
setKeyRegistrationState(Context.KeyRegistrationState keyRegistrationState)
Set the SelectionKey's next registration state |
void |
setPipeline(Pipeline pipeline)
Set the Pipeline that will execute this instance. |
void |
setProtocol(Controller.Protocol protocol)
|
void |
setProtocolChain(ProtocolChain protocolChain)
Set the ProtocolChain used by this Context. |
void |
setSelectionKey(SelectionKey key)
Set the connection SelectionKey. |
void |
setSelectorHandler(SelectorHandler selectorHandler)
Set the current SelectorHandler this instance is executing. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String THROWABLE
| Constructor Detail |
|---|
public Context()
| Method Detail |
|---|
public void copyTo(Copyable copy)
Copyable
copyTo in interface Copyablecopy - represents target object, where current object's content will be copiedpublic Object removeAttribute(String key)
removeAttribute in interface AttributeHolderkey - - name of an attribute
public void setAttribute(String key,
Object value)
setAttribute in interface AttributeHolderkey - - name of an attributevalue - - value of named attributepublic Object getAttribute(String key)
getAttribute in interface AttributeHolderkey - - name of an attribute
public AttributeHolder getAttributeHolderByScope(Context.AttributeScope scope)
AttributeHolder, which corresponds to the
given AttributeScope
scope - - AttributeScope
AttributeHolder instance, which contains
AttributeScope attributespublic void setAttributes(Map<String,Object> attributes)
Map of attribute name/value pairs.
Old AttributeHolder values will not be available.
Later changes of this Map will lead to changes to the current
AttributeHolder.
setAttributes in interface AttributeHolderattributes - - map of name/value pairspublic Map<String,Object> getAttributes()
Map of attribute name/value pairs.
Updates, performed on the returned Map will be reflected in
this AttributeHolder
getAttributes in interface AttributeHolderMap of attribute name/value pairspublic SelectionKey getSelectionKey()
public void setSelectionKey(SelectionKey key)
key - - set this Context's SelectionKeypublic Controller getController()
public void setController(Controller controller)
controller - public void recycle()
public Context.KeyRegistrationState getKeyRegistrationState()
public void setKeyRegistrationState(Context.KeyRegistrationState keyRegistrationState)
keyRegistrationState - - set this Context's SelectionKey
registration statepublic ProtocolChain getProtocolChain()
ProtocolChain executed by this instance.
ProtocolChain instancepublic void setProtocolChain(ProtocolChain protocolChain)
ProtocolChain used by this Context.
protocolChain - instance of ProtocolChain to be used by the Contextpublic Context.OpType getCurrentOpType()
public void setCurrentOpType(Context.OpType currentOpType)
currentOpType - sets current operation typeprotected void configureOpType(SelectionKey key)
currentOpType based on the
SelectionKey.readyOps() values.
key -
public void execute()
throws PipelineFullException
PipelineFullException
public void execute(ContextTask contextTask)
throws PipelineFullException
contextTask - ContextTask, which will be
executed by Pipeline
PipelineFullException
public void execute(ContextTask contextTask,
boolean runInSeparateThread)
throws PipelineFullException
contextTask - ContextTask, which will be
executed by PipelinerunInSeparateThread - if true - ContextTask will
be executed in separate thread, false - in current thread.
PipelineFullExceptionpublic ProtocolChainInstanceHandler getProtocolChainInstanceHandler()
ProtocolChainInstanceListener associated with this
Context
public Pipeline getPipeline()
Pipeline executing this instance.
Pipelinepublic void setPipeline(Pipeline pipeline)
Pipeline that will execute this instance.
pipeline - the Pipeline to setprotected void setIOEvent(IOEvent<Context> ioEvent)
ioEvent - the IOEvent to setprotected IOEvent getIOEvent()
IOEvent associated with this
instance.
IOEvent associated with this
instance.public Controller.Protocol getProtocol()
public void setProtocol(Controller.Protocol protocol)
protocol - The current protocol.public SelectorHandler getSelectorHandler()
SelectorHandler this instance is executing.
SelectorHandler this instance is executing.public void setSelectorHandler(SelectorHandler selectorHandler)
SelectorHandler this instance is executing.
selectorHandler - SelectorHandlerpublic AsyncQueueReadable getAsyncQueueReadable()
AsyncQueueReadable, assciated with the current
Context. This method is not threadsafe.
AsyncQueueReadablepublic AsyncQueueWritable getAsyncQueueWritable()
AsyncQueueWritable, assciated with the current
Context. This method is not threadsafe.
AsyncQueueWritableprotected AsyncQueueReader getAsyncQueueReader()
AsyncQueueReader
AsyncQueueReaderprotected void setAsyncQueueReader(AsyncQueueReader asyncQueueReader)
AsyncQueueReader
asyncQueueReader - AsyncQueueReaderprotected AsyncQueueWriter getAsyncQueueWriter()
AsyncQueueWriter
AsyncQueueWriterprotected void setAsyncQueueWriter(AsyncQueueWriter asyncQueueWriter)
AsyncQueueWriter
asyncQueueWriter - AsyncQueueWriter
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||