org.glassfish.grizzly.strategies
Class SimpleDynamicNIOStrategy
java.lang.Object
org.glassfish.grizzly.strategies.SimpleDynamicNIOStrategy
- All Implemented Interfaces:
- IOStrategy, WorkerThreadPoolConfigProducer
public final class SimpleDynamicNIOStrategy
- extends java.lang.Object
- implements IOStrategy
Simple dynamic strategy, which switches I/O processing strategies, basing
on statistics. This implementation takes in consideration number of
SelectionKeys, which were selected last time by
Selector.
SimpleDynamicIOStrategy is able to use 2 strategies underneath:
SameThreadIOStrategy, WorkerThreadIOStrategy.
And is able to switch between them basing on corresponding threshold
(threshold represents the number of selected
SelectionKeys).
So the strategy is getting applied following way:
SameThreadIOStrategy --(worker-thread threshold)--> WorkerThreadIOStrategy.
- Author:
- Alexey Stashok
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
getInstance
public static SimpleDynamicNIOStrategy getInstance()
executeIoEvent
public boolean executeIoEvent(Connection connection,
IOEvent ioEvent)
throws java.io.IOException
- Description copied from interface:
IOStrategy
- The
SelectorRunner will invoke this
method to allow the strategy implementation to decide how the
IOEvent will be handled.
- Specified by:
executeIoEvent in interface IOStrategy
- Parameters:
connection - the Connection upon which the provided
IOEvent occurred.ioEvent - the IOEvent that triggered execution of this
strategy
- 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:
java.io.IOException - if an error occurs processing the IOEvent.
createDefaultWorkerPoolConfig
public ThreadPoolConfig createDefaultWorkerPoolConfig(Transport transport)
- Specified by:
createDefaultWorkerPoolConfig in interface WorkerThreadPoolConfigProducer
Copyright © 2011 Oracle Corpration. All Rights Reserved.