org.pf.net
Class RequestServer

java.lang.Object
  extended by org.pf.util.ExceptionIgnorer
      extended by org.pf.net.RequestServer
All Implemented Interfaces:
java.lang.Runnable
Direct Known Subclasses:
BinaryRequestServer, TextRequestServer

public abstract class RequestServer
extends ExceptionIgnorer
implements java.lang.Runnable

A generic server that listens to a port and starts processing threads on the incoming requests.

Version:
1.1
Author:
Manfred Duchrow

Constructor Summary
RequestServer()
          Initialize the new instance with default values.
RequestServer(ExceptionHandler exHandler)
          Initialize the new instance with an expection handler.
RequestServer(int port)
          Initialize the new instance with a port number.
RequestServer(int port, ExceptionHandler exHandler)
          Initialize the new instance with a port number and an expection handler.
 
Method Summary
 void run()
          Opens the server socket on the configured port then runs a loop to listen on this socket until done is set to true and then closes the socket.
 
Methods inherited from class org.pf.util.ExceptionIgnorer
exceptionOccurred, getExceptionHandler, setExceptionHandler
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RequestServer

public RequestServer()
Initialize the new instance with default values.


RequestServer

public RequestServer(ExceptionHandler exHandler)
Initialize the new instance with an expection handler.


RequestServer

public RequestServer(int port)
Initialize the new instance with a port number.


RequestServer

public RequestServer(int port,
                     ExceptionHandler exHandler)
Initialize the new instance with a port number and an expection handler.

Method Detail

run

public void run()
Opens the server socket on the configured port then runs a loop to listen on this socket until done is set to true and then closes the socket. The socket will also be closed in case of any runtime exception.

Specified by:
run in interface java.lang.Runnable