de.netseeker.ejoe
Class ConnectionProcessorManager

java.lang.Object
  extended byjava.lang.Thread
      extended byde.netseeker.ejoe.ConnectionProcessorManager
All Implemented Interfaces:
ChannelRegistrar, java.lang.Runnable

final class ConnectionProcessorManager
extends java.lang.Thread
implements ChannelRegistrar

The ConnectionProcessorManager handles the further processing of accepted client connections. It simply does only separate the readable connections from the incoming flood of accepted connections and schedules a new ConnectionProcessor which will handle read/write operations and adapter invoking for each of the selected connections. This is compareable to the *old BIO style* where one thread is used for each connection.

Author:
netseeker

Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
ConnectionProcessorManager(ConnectionHeader serverInfo, ServerHandler handler, int maxReadProcessors, int maxWriteProcessors)
          Creates a new ConnectionProcessorManager instance.
ConnectionProcessorManager(ConnectionHeader serverInfo, ServerHandler handler, int maxProcessors, int maxWriteProcessors, boolean useThreadedReadProcessors)
          Creates a new ConnectionProcessorManager instance
 
Method Summary
 boolean isValid()
          Tells whether this ChannelRegistrar is running and accepting channels for further processing
 void register(ConnectionHeader clientInfo, int interest)
          (Re-)Adds a incomplete read channel to the list of channels processed by the Selector of this ChannelRegistrar
 void run()
           
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ConnectionProcessorManager

public ConnectionProcessorManager(ConnectionHeader serverInfo,
                                  ServerHandler handler,
                                  int maxReadProcessors,
                                  int maxWriteProcessors)
                           throws java.io.IOException
Creates a new ConnectionProcessorManager instance. Using this constructor will force the newly created instance to use a non-blocking threadpool for invocation of read processor threads.

Parameters:
serverInfo - prefilled ConnectionHeader container server settings, eg. compression setting
handler - server handler to use when processing retrieved data
maxReadProcessors - amount of read processors threads to use for reading data and processing these retrieved data
maxWriteProcessors - amount of writer threads to use for sending server responses to clients
Throws:
java.io.IOException

ConnectionProcessorManager

public ConnectionProcessorManager(ConnectionHeader serverInfo,
                                  ServerHandler handler,
                                  int maxProcessors,
                                  int maxWriteProcessors,
                                  boolean useThreadedReadProcessors)
                           throws java.io.IOException
Creates a new ConnectionProcessorManager instance

Parameters:
serverInfo - prefilled ConnectionHeader container server settings, eg. compression setting
handler - server handler to use when processing retrieved data
maxWriteProcessors - amount of writer threads to use for sending server responses to clients
useThreadedReadProcessors - whether to use a blocking thread start mechanism, which will invoke new read processor threads not until the amount of concurrently running read processors is lower than maxReadProcessors
Throws:
java.io.IOException
Method Detail

run

public void run()
Specified by:
run in interface java.lang.Runnable

register

public void register(ConnectionHeader clientInfo,
                     int interest)
Description copied from interface: ChannelRegistrar
(Re-)Adds a incomplete read channel to the list of channels processed by the Selector of this ChannelRegistrar

Specified by:
register in interface ChannelRegistrar
Parameters:
clientInfo - the ConnectionHeader initially sent by the receiver
interest - OP_WRITE or OP_READ interest

isValid

public boolean isValid()
Description copied from interface: ChannelRegistrar
Tells whether this ChannelRegistrar is running and accepting channels for further processing

Specified by:
isValid in interface ChannelRegistrar
Returns:
true if this ChannelRegistrar is running and accepting channels for further processing otherwise false


Copyright © 2005-2006 netseeker. All Rights Reserved.