Package org.glassfish.grizzly
Interface IOStrategy
-
- All Superinterfaces:
WorkerThreadPoolConfigProducer
- All Known Implementing Classes:
AbstractIOStrategy,LeaderFollowerNIOStrategy,SameThreadIOStrategy,SimpleDynamicNIOStrategy,WorkerThreadIOStrategy
public interface IOStrategy extends WorkerThreadPoolConfigProducer
strategy is responsible for making decision howRunnabletask will be run: in current thread, worker thread. strategy can make any other processing decisions.- Author:
- Alexey Stashok
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description booleanexecuteIoEvent(Connection connection, IOEvent ioEvent)TheSelectorRunnerwill invoke this method to allow the strategy implementation to decide how theIOEventwill be handled.booleanexecuteIoEvent(Connection connection, IOEvent ioEvent, boolean isIoEventEnabled)TheSelectorRunnerwill invoke this method to allow the strategy implementation to decide how theIOEventwill be handled.ExecutorgetThreadPoolFor(Connection connection, IOEvent ioEvent)Returns anExecutorto be used to run given ioEvent processing for the given connection.-
Methods inherited from interface org.glassfish.grizzly.strategies.WorkerThreadPoolConfigProducer
createDefaultWorkerPoolConfig
-
-
-
-
Method Detail
-
executeIoEvent
boolean executeIoEvent(Connection connection, IOEvent ioEvent) throws IOException
TheSelectorRunnerwill invoke this method to allow the strategy implementation to decide how theIOEventwill be handled.- Parameters:
connection- theConnectionupon which the providedIOEventoccurred.ioEvent- theIOEventthat triggered execution of thisstrategy- 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.
-
executeIoEvent
boolean executeIoEvent(Connection connection, IOEvent ioEvent, boolean isIoEventEnabled) throws IOException
TheSelectorRunnerwill invoke this method to allow the strategy implementation to decide how theIOEventwill be handled.- Parameters:
connection- theConnectionupon which the providedIOEventoccurred.ioEvent- theIOEventthat triggered execution of thisstrategyisIoEventEnabled- 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
Executor getThreadPoolFor(Connection connection, IOEvent ioEvent)
Returns anExecutorto 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.- Parameters:
connection-ConnectionioEvent- the event to get the Executor for- Returns:
- an
Executorto be used to run given ioEvent processing for the given connection
-
-