de.esw.eengine.net
Class AbstractServer

java.lang.Object
  extended by de.esw.eengine.net.ChannelHelper
      extended by de.esw.eengine.net.AbstractServer
All Implemented Interfaces:
java.lang.Runnable
Direct Known Subclasses:
TCPServer, UDPServer

public abstract class AbstractServer
extends ChannelHelper
implements java.lang.Runnable

Since:
1.0
Version:
$Id: AbstractServer.java 201 2005-07-17 18:38:14Z markusw $
Author:
markusw

Constructor Summary
AbstractServer(int bufferSize, java.lang.String charset)
          Creates an AbstractServer with a default thread pool of at least 1 threads and at most 5 threads and a timeout of 30 seconds.
AbstractServer(int bufferSize, java.lang.String charset, int minThreads, int maxThreads, int threadTimeout)
           
 
Method Summary
 void dispose()
           
 void run()
           
 void setWriteRequest(java.nio.channels.SelectionKey key, boolean write)
           
 void shutdown()
          Terminates the server
 
Methods inherited from class de.esw.eengine.net.ChannelHelper
readBoolean, readBytes, readFile, readInt, readLong, readObject, readString, writeBoolean, writeBytes, writeFile, writeInt, writeLong, writeObject, writeString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractServer

public AbstractServer(int bufferSize,
                      java.lang.String charset)
               throws EEngineException
Creates an AbstractServer with a default thread pool of at least 1 threads and at most 5 threads and a timeout of 30 seconds.

Parameters:
bufferSize - Size of the communication buffer in bytes
charset - Charset to use for encoding and decoding
Throws:
EEngineException - Thrown on network i/o errors

AbstractServer

public AbstractServer(int bufferSize,
                      java.lang.String charset,
                      int minThreads,
                      int maxThreads,
                      int threadTimeout)
               throws EEngineException
Parameters:
bufferSize - Size of the communication buffer in bytes
charset - Charset to use for encoding and decoding
minThreads - Minimal amount of threads to keep in the pool
maxThreads - Maximal amount of theads to be in pool
threadTimeout - Timeout in seconds the thread pool uses to reduce size
Throws:
EEngineException - Thrown on network i/o errors
Method Detail

run

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

shutdown

public void shutdown()
Terminates the server


setWriteRequest

public void setWriteRequest(java.nio.channels.SelectionKey key,
                            boolean write)
Parameters:
key - Key to change writeable state for
write - True if we want to write, false otherwise

dispose

public void dispose()
             throws EEngineException
Throws:
EEngineException - Thrown on network i/o errors