org.glassfish.grizzly.strategies
Class SameThreadIOStrategy

java.lang.Object
  extended by org.glassfish.grizzly.strategies.AbstractIOStrategy
      extended by org.glassfish.grizzly.strategies.SameThreadIOStrategy
All Implemented Interfaces:
IOStrategy, WorkerThreadPoolConfigProducer

public final class SameThreadIOStrategy
extends AbstractIOStrategy

IOStrategy, which executes Processors in a current thread.

Author:
Alexey Stashok

Field Summary
 
Fields inherited from class org.glassfish.grizzly.strategies.AbstractIOStrategy
ENABLE_INTEREST_PROCESSING_HANDLER
 
Method Summary
 ThreadPoolConfig createDefaultWorkerPoolConfig(Transport transport)
           
 boolean executeIoEvent(Connection connection, IOEvent ioEvent, boolean isIoEventEnabled)
          The SelectorRunner will invoke this method to allow the strategy implementation to decide how the IOEvent will be handled.
static SameThreadIOStrategy getInstance()
           
 
Methods inherited from class org.glassfish.grizzly.strategies.AbstractIOStrategy
executeIoEvent, fireIOEvent, getWorkerThreadPool, isExecuteInWorkerThread, isReadWrite
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static SameThreadIOStrategy getInstance()

executeIoEvent

public boolean executeIoEvent(Connection connection,
                              IOEvent ioEvent,
                              boolean isIoEventEnabled)
                       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.

Parameters:
connection - the Connection upon which the provided IOEvent occurred.
ioEvent - the IOEvent that triggered execution of this strategy
isIoEventEnabled - true if IOEvent is still enabled on the Connection, 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:
java.io.IOException - if an error occurs processing the IOEvent.

createDefaultWorkerPoolConfig

public ThreadPoolConfig createDefaultWorkerPoolConfig(Transport transport)
Specified by:
createDefaultWorkerPoolConfig in interface WorkerThreadPoolConfigProducer
Overrides:
createDefaultWorkerPoolConfig in class AbstractIOStrategy


Copyright © 2012 Oracle Corporation. All Rights Reserved.