Package org.glassfish.grizzly.strategies
Class AbstractIOStrategy
- java.lang.Object
-
- org.glassfish.grizzly.strategies.AbstractIOStrategy
-
- All Implemented Interfaces:
IOStrategy,WorkerThreadPoolConfigProducer
- Direct Known Subclasses:
LeaderFollowerNIOStrategy,SameThreadIOStrategy,WorkerThreadIOStrategy
public abstract class AbstractIOStrategy extends Object implements IOStrategy
- Author:
- oleksiys
-
-
Field Summary
Fields Modifier and Type Field Description protected static IOEventLifeCycleListenerENABLE_INTEREST_LIFECYCLE_LISTENER
-
Constructor Summary
Constructors Constructor Description AbstractIOStrategy()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ThreadPoolConfigcreateDefaultWorkerPoolConfig(Transport transport)booleanexecuteIoEvent(Connection connection, IOEvent ioEvent)TheSelectorRunnerwill invoke this method to allow the strategy implementation to decide how theIOEventwill be handled.protected static voidfireIOEvent(Connection connection, IOEvent ioEvent, IOEventLifeCycleListener listener, Logger logger)ExecutorgetThreadPoolFor(Connection connection, IOEvent ioEvent)Returns anExecutorto be used to run given ioEvent processing for the given connection.protected static booleanisReadWrite(IOEvent ioEvent)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.glassfish.grizzly.IOStrategy
executeIoEvent
-
-
-
-
Field Detail
-
ENABLE_INTEREST_LIFECYCLE_LISTENER
protected static final IOEventLifeCycleListener ENABLE_INTEREST_LIFECYCLE_LISTENER
-
-
Method Detail
-
createDefaultWorkerPoolConfig
public ThreadPoolConfig createDefaultWorkerPoolConfig(Transport transport)
- Specified by:
createDefaultWorkerPoolConfigin interfaceWorkerThreadPoolConfigProducer
-
executeIoEvent
public final boolean executeIoEvent(Connection connection, IOEvent ioEvent) throws IOException
Description copied from interface:IOStrategyTheSelectorRunnerwill invoke this method to allow the strategy implementation to decide how theIOEventwill be handled.- Specified by:
executeIoEventin interfaceIOStrategy- 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.
-
getThreadPoolFor
public Executor getThreadPoolFor(Connection connection, IOEvent ioEvent)
Description copied from interface:IOStrategyReturns 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.- Specified by:
getThreadPoolForin interfaceIOStrategy- Parameters:
connection-ConnectionioEvent- the event to get the Executor for- Returns:
- an
Executorto be used to run given ioEvent processing for the given connection
-
isReadWrite
protected static boolean isReadWrite(IOEvent ioEvent)
-
fireIOEvent
protected static void fireIOEvent(Connection connection, IOEvent ioEvent, IOEventLifeCycleListener listener, Logger logger)
-
-