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
-
Field Summary
Modifier and TypeFieldDescriptionprotected IOEvent
Processing IOEventprotected boolean
protected final Context.MinimalisticArrayList<IOEventLifeCycleListener>
IOEventProcessingHandler is called to notify about IOEvent processing life-cycle events like suspend, resume, complete.protected boolean
true if this IOEvent processing was suspended during its processing, or false otherwise. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addLifeCycleListener
(IOEventLifeCycleListener listener) void
complete
(ProcessorResult result) static Context
create
(Connection connection) static Context
create
(Connection connection, Processor processor, IOEvent ioEvent, IOEventLifeCycleListener lifeCycleListener) Get attributes (AttributeHolder
), associated with the processingContext
.Get the processingConnection
.Get the processingIOEvent
.boolean
hasLifeCycleListener
(IOEventLifeCycleListener listener) boolean
void
recycle()
Recycle thisContext
protected void
release()
Alternative torecycle()
that allows cleanup actions to be performed without returning this instance to the cache.void
boolean
void
reset()
If implementation usesObjectPool
to store and reuseContext
instances - this method will be called beforeContext
will be offered to pool.void
resume()
Notify Context its processing will be resumed in the current thread.void
setConnection
(Connection connection) Set the processingConnection
.void
setIoEvent
(IOEvent ioEvent) Set the processingIOEvent
.void
Switches processing to the manual IOEvent control.void
setProcessor
(Processor processor) void
suspend()
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
.AttributeHolder
is cleared after each I/O event processing. Method may return null, if there were no attributes added before.- Specified by:
getAttributes
in interfaceAttributeStorage
- Returns:
- attributes (
AttributeHolder
), associated with the processingContext
.
-
reset
public void reset()If implementation usesObjectPool
to store and reuseContext
instances - this method will be called beforeContext
will 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
-