pyrasun.eio
Class EIOPoolingStrategy

java.lang.Object
  extended bypyrasun.eio.EIOPoolingStrategy

public class EIOPoolingStrategy
extends java.lang.Object

The aggregate strategy for how to do thread pooling and generally how to handle individual EIO Events. Intended to be applied against a single EndpointCoordinator (e.g. type of endpoint).


Field Summary
static EIOPoolingStrategy BLOCKING_ACCEPTOR
          Strategy for a blocking acceptor for a ServerSocket (AcceptingEndpoint).
static EIOPoolingStrategy DEDICATED_READER
          Strategy for a ReadWriteEndpoint.
static EIOPoolingStrategy NONBLOCKING_ACCEPTOR
          Strategy for a non-blocking acceptor for a ServerSocket (AcceptingEndpoint).
static EIOPoolingStrategy SELECTOR_READER
          Strategy for a ReadWriteEndpoint.
static EIOPoolingStrategy USE_ONE_POOL
          Strategy for a ReadWriteEndpoint.
static EIOPoolingStrategy USE_RP_POOLS
          Strategy for a ReadWriteEndpoint.
static EIOPoolingStrategy USE_RWP_POOLS
          Strategy for a ReadWriteEndpoint.
 
Constructor Summary
EIOPoolingStrategy(java.lang.String name, EIOEventDescriptor[] eventDescriptors)
          Construct us a spanking new strategy
 
Method Summary
 EIOPoolingStrategy cloneIt()
          Clone this strategy.
 java.util.Iterator getDescriptorIterator()
          Return an Iterator over the supported descriptors.
 EIOEventDescriptor getEventDescriptor(EIOEvent event)
          Get an EIOEventDescriptor by its corresponding EIOEvent (e.g.
 java.lang.String getName()
           
static EIOPoolingStrategy getStrategyByName(java.lang.String name)
          Get a strategy by name (intended for use by things like configuration files).
 java.lang.String toString()
          String me, baby!
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

BLOCKING_ACCEPTOR

public static EIOPoolingStrategy BLOCKING_ACCEPTOR
Strategy for a blocking acceptor for a ServerSocket (AcceptingEndpoint). A single thread will be created dedicated to calling accept() on the socket.


NONBLOCKING_ACCEPTOR

public static EIOPoolingStrategy NONBLOCKING_ACCEPTOR
Strategy for a non-blocking acceptor for a ServerSocket (AcceptingEndpoint). Uses ACCEPT events from the EIOEventManager that gets propogated to the acceptor worker when a client connection is attempted.


USE_RWP_POOLS

public static EIOPoolingStrategy USE_RWP_POOLS
Strategy for a ReadWriteEndpoint. Uses seperate pools for reading, writing, and processing input.


USE_RP_POOLS

public static EIOPoolingStrategy USE_RP_POOLS
Strategy for a ReadWriteEndpoint. Uses seperate pools for reading and processing input. Writing is piggybacked onto the processing thread.


USE_ONE_POOL

public static EIOPoolingStrategy USE_ONE_POOL
Strategy for a ReadWriteEndpoint. Uses only one pool for everything - reading, writing, and processing are all piggy backed onto the same thread pool.


DEDICATED_READER

public static EIOPoolingStrategy DEDICATED_READER
Strategy for a ReadWriteEndpoint. Uses dedicated threads for reading, seperate pools for writing and processing input. NOTE: WRITEs are disabled in this strategy - from a pooling perspective. We force blocking direct writes in this instance.


SELECTOR_READER

public static EIOPoolingStrategy SELECTOR_READER
Strategy for a ReadWriteEndpoint. Uses dedicated threads for reading, seperate pools for writing and processing input. NOTE: WRITEs are disabled in this strategy - from a pooling perspective. We force blocking direct writes in this instance.

Constructor Detail

EIOPoolingStrategy

public EIOPoolingStrategy(java.lang.String name,
                          EIOEventDescriptor[] eventDescriptors)
Construct us a spanking new strategy

Method Detail

cloneIt

public EIOPoolingStrategy cloneIt()
Clone this strategy. NOTE: only prototypical information from the underlying EIOEventDescriptors is cloned, none of the per-instance stuff is.


getName

public java.lang.String getName()

getDescriptorIterator

public java.util.Iterator getDescriptorIterator()
Return an Iterator over the supported descriptors. Each element will be of type EIOEventDescriptor.


getStrategyByName

public static EIOPoolingStrategy getStrategyByName(java.lang.String name)
Get a strategy by name (intended for use by things like configuration files). The names here match the names of the public EIOPoolingStrategy fields.


getEventDescriptor

public EIOEventDescriptor getEventDescriptor(EIOEvent event)
Get an EIOEventDescriptor by its corresponding EIOEvent (e.g. EIOEvent.READ, EIOEvent.PROCESS, etc).


toString

public java.lang.String toString()
String me, baby!



Pyrasun EmberIO