java.lang.Object
org.glassfish.grizzly.strategies.AbstractIOStrategy
org.glassfish.grizzly.strategies.SameThreadIOStrategy
- All Implemented Interfaces:
IOStrategy
,WorkerThreadPoolConfigProducer
IOStrategy
, which executes Processor
s in a current
thread.- Author:
- Alexey Stashok
-
Field Summary
Fields inherited from class org.glassfish.grizzly.strategies.AbstractIOStrategy
ENABLE_INTEREST_LIFECYCLE_LISTENER
-
Method Summary
Modifier and TypeMethodDescriptioncreateDefaultWorkerPoolConfig
(Transport transport) boolean
executeIoEvent
(Connection connection, IOEvent ioEvent, boolean isIoEventEnabled) TheSelectorRunner
will invoke this method to allow the strategy implementation to decide how theIOEvent
will be handled.static SameThreadIOStrategy
getThreadPoolFor
(Connection connection, IOEvent ioEvent) Returns anExecutor
to be used to run given ioEvent processing for the given connection.Methods inherited from class org.glassfish.grizzly.strategies.AbstractIOStrategy
executeIoEvent, fireIOEvent, isReadWrite
-
Method Details
-
getInstance
-
executeIoEvent
public boolean executeIoEvent(Connection connection, IOEvent ioEvent, boolean isIoEventEnabled) throws IOException Description copied from interface:IOStrategy
TheSelectorRunner
will invoke this method to allow the strategy implementation to decide how theIOEvent
will be handled.- Parameters:
connection
- theConnection
upon which the providedIOEvent
occurred.ioEvent
- theIOEvent
that triggered execution of thisstrategy
isIoEventEnabled
- true if IOEvent is still enabled on theConnection
, or false if IOEvent was preliminary disabled or IOEvent is being simulated.- Returns:
- true, if this thread should keep processing IOEvents on the current and other Connections, or false if this thread should hand-off the farther IOEvent processing on any Connections, which means IOStrategy is becoming responsible for continuing IOEvent processing (possibly starting new thread, which will handle IOEvents).
- Throws:
IOException
- if an error occurs processing theIOEvent
.
-
getThreadPoolFor
Description copied from interface:IOStrategy
Returns anExecutor
to be used to run given ioEvent processing for the given connection. A null value will be returned if the ioEvent should be executed in the kernel thread.- Specified by:
getThreadPoolFor
in interfaceIOStrategy
- Overrides:
getThreadPoolFor
in classAbstractIOStrategy
- Parameters:
connection
-Connection
ioEvent
- the event to get the Executor for- Returns:
- an
Executor
to be used to run given ioEvent processing for the given connection
-
createDefaultWorkerPoolConfig
- Specified by:
createDefaultWorkerPoolConfig
in interfaceWorkerThreadPoolConfigProducer
- Overrides:
createDefaultWorkerPoolConfig
in classAbstractIOStrategy
-