Top Description Methods
org.glassfish.grizzly

public Interface IOStrategy

extends WorkerThreadPoolConfigProducer
Known Direct Implementers
org.glassfish.grizzly.strategies.AbstractIOStrategy, org.glassfish.grizzly.strategies.SimpleDynamicNIOStrategy
Imports
java.io.IOException, java.util.concurrent.Executor, org.glassfish.grizzly.strategies.WorkerThreadPoolConfigProducer

strategy is responsible for making decision how Runnable task will be run: in current thread, worker thread. strategy can make any other processing decisions.
Author
Alexey Stashok

Method Summary

Modifier and TypeMethod and Description
public boolean

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).
executeIoEvent
(Connection<L>
the Connection upon which the provided IOEvent occurred.
connection
,
IOEvent
the IOEvent that triggered execution of this strategy
ioEvent
)

The org.glassfish.grizzly.nio.SelectorRunner will invoke this method to allow the strategy implementation to decide how the IOEvent will be handled.

public boolean

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).
executeIoEvent
(Connection<L>
the Connection upon which the provided IOEvent occurred.
connection
,
IOEvent
the IOEvent that triggered execution of this strategy
ioEvent
,
boolean
true if IOEvent is still enabled on the Connection, or false if IOEvent was preliminary disabled or IOEvent is being simulated.
isIoEventEnabled
)

The org.glassfish.grizzly.nio.SelectorRunner will invoke this method to allow the strategy implementation to decide how the IOEvent will be handled.

public Executor

Returns:

an Executor to be used to run given ioEvent processing for the given connection
getThreadPoolFor
(Connection<L> connection, IOEvent
the event to get the Executor for
ioEvent
)

Returns an Executor to be used to run given ioEvent processing for the given connection.

Inherited from org.glassfish.grizzly.strategies.WorkerThreadPoolConfigProducer:
createDefaultWorkerPoolConfig

Method Detail

executeIoEventback to summary
public boolean executeIoEvent(Connection<L> connection, IOEvent ioEvent) throws IOException

The org.glassfish.grizzly.nio.SelectorRunner will invoke this method to allow the strategy implementation to decide how the IOEvent will be handled.

Parameters
connection:Connection<L>

the Connection upon which the provided IOEvent occurred.

ioEvent:IOEvent

the IOEvent that triggered execution of this strategy

Returns:boolean

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).

Exceptions
IOException:
if an error occurs processing the IOEvent.
executeIoEventback to summary
public boolean executeIoEvent(Connection<L> connection, IOEvent ioEvent, boolean isIoEventEnabled) throws IOException

The org.glassfish.grizzly.nio.SelectorRunner will invoke this method to allow the strategy implementation to decide how the IOEvent will be handled.

Parameters
connection:Connection<L>

the Connection upon which the provided IOEvent occurred.

ioEvent:IOEvent

the IOEvent that triggered execution of this strategy

isIoEventEnabled:boolean

true if IOEvent is still enabled on the Connection, or false if IOEvent was preliminary disabled or IOEvent is being simulated.

Returns:boolean

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).

Exceptions
IOException:
if an error occurs processing the IOEvent.
getThreadPoolForback to summary
public Executor getThreadPoolFor(Connection<L> connection, IOEvent ioEvent)

Returns an Executor 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.

Parameters
connection:Connection<L>

Connection

ioEvent:IOEvent

the event to get the Executor for

Returns:Executor

an Executor to be used to run given ioEvent processing for the given connection