java.lang.Object
org.glassfish.grizzly.Context
- All Implemented Interfaces:
AttributeStorage,Cacheable
Object, which is responsible for holding context during I/O event processing.
- Author:
- Alexey Stashok
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected IOEventProcessing IOEventprotected booleanprotected final Context.MinimalisticArrayList<IOEventLifeCycleListener>IOEventProcessingHandler is called to notify about IOEvent processing life-cycle events like suspend, resume, complete.protected booleantrue if this IOEvent processing was suspended during its processing, or false otherwise. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddLifeCycleListener(IOEventLifeCycleListener listener) voidcomplete(ProcessorResult result) static Contextcreate(Connection connection) static Contextcreate(Connection connection, Processor processor, IOEvent ioEvent, IOEventLifeCycleListener lifeCycleListener) Get attributes (AttributeHolder), associated with the processingContext.Get the processingConnection.Get the processingIOEvent.booleanhasLifeCycleListener(IOEventLifeCycleListener listener) booleanvoidrecycle()Recycle thisContextprotected voidrelease()Alternative torecycle()that allows cleanup actions to be performed without returning this instance to the cache.voidbooleanvoidreset()If implementation usesObjectPoolto store and reuseContextinstances - this method will be called beforeContextwill be offered to pool.voidresume()Notify Context its processing will be resumed in the current thread.voidsetConnection(Connection connection) Set the processingConnection.voidsetIoEvent(IOEvent ioEvent) Set the processingIOEvent.voidSwitches processing to the manual IOEvent control.voidsetProcessor(Processor processor) voidsuspend()Notify Context its processing will be suspended in the current thread.boolean
-
Field Details
-
ioEvent
Processing IOEvent -
lifeCycleListeners
IOEventProcessingHandler is called to notify about IOEvent processing life-cycle events like suspend, resume, complete. -
wasSuspended
protected boolean wasSuspendedtrue if this IOEvent processing was suspended during its processing, or false otherwise. -
isManualIOEventControl
protected boolean isManualIOEventControl
-
-
Constructor Details
-
Context
public Context()
-
-
Method Details
-
create
-
create
public static Context create(Connection connection, Processor processor, IOEvent ioEvent, IOEventLifeCycleListener lifeCycleListener) -
suspend
public void suspend()Notify Context its processing will be suspended in the current thread. -
resume
public void resume()Notify Context its processing will be resumed in the current thread. -
complete
-
wasSuspended
public boolean wasSuspended()- Returns:
- true if this IOEvent processing was suspended during its processing, or false otherwise.
-
setManualIOEventControl
public void setManualIOEventControl()Switches processing to the manual IOEvent control.Connection.enableIOEvent(org.glassfish.grizzly.IOEvent)orConnection.disableIOEvent(org.glassfish.grizzly.IOEvent)might be explicitly called. -
isManualIOEventControl
public boolean isManualIOEventControl()- Returns:
- true, if processing was switched to the manual IOEvent control, or false otherwise.
-
getIoEvent
Get the processingIOEvent.- Returns:
- the processing
IOEvent.
-
setIoEvent
Set the processingIOEvent.- Parameters:
ioEvent- the processingIOEvent.
-
getConnection
Get the processingConnection.- Returns:
- the processing
Connection.
-
setConnection
Set the processingConnection.- Parameters:
connection- the processingConnection.
-
getProcessor
-
setProcessor
-
hasLifeCycleListener
-
addLifeCycleListener
-
removeLifeCycleListener
-
removeAllLifeCycleListeners
public void removeAllLifeCycleListeners() -
getAttributes
Get attributes (AttributeHolder), associated with the processingContext.AttributeHolderis cleared after each I/O event processing. Method may return null, if there were no attributes added before.- Specified by:
getAttributesin interfaceAttributeStorage- Returns:
- attributes (
AttributeHolder), associated with the processingContext.
-
reset
public void reset()If implementation usesObjectPoolto store and reuseContextinstances - this method will be called beforeContextwill be offered to pool. -
recycle
public void recycle()Recycle thisContext -
release
protected void release()Alternative torecycle()that allows cleanup actions to be performed without returning this instance to the cache. By default, this is a no-op.- Since:
- 2.3.29
-