|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object infoservice.mailsystem.central.server.GenericServer
public class GenericServer
This class is a generic server implementation. It waits for incoming connections and forwards them to the specified connection handler.
Field Summary | |
---|---|
private java.net.InetAddress |
m_serverAddress
Stores the local address the server will listen on. |
private IServerImplementationFactory |
m_serverImplementationFactory
Stores the factory which creates the server implementations for handling the accepted connections from the clients. |
private int |
m_serverPort
Stores the local port the server will listen on. |
private java.net.ServerSocket |
m_serverSocket
Stores the ServerSocket used for listening. |
private java.lang.Thread |
m_serverSocketThread
Stores the thread which handles all requests reaching the server socket. |
private java.lang.Object |
m_synchronizer
This object is used for internal synchronization with the server socket handling thread. |
Constructor Summary | |
---|---|
GenericServer(int a_serverPort,
java.net.InetAddress a_serverAddress)
Creates a new instance of GenericServer. |
Method Summary | |
---|---|
private IServerImplementationFactory |
getServerImplementationFactory()
Returns the current server implementation factory. |
void |
run()
This is the implementation of the ServerSocket management thread. |
void |
setConnectionHandlerFactory(IServerImplementationFactory a_serverImplementationFactory)
Changes the factory used for creating the server implementations for the accepted connections from the clients. |
void |
startServer()
Starts the GenericServer. |
void |
stopServer()
Stops listening for new requests. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private java.net.InetAddress m_serverAddress
private int m_serverPort
private java.net.ServerSocket m_serverSocket
private java.lang.Thread m_serverSocketThread
private java.lang.Object m_synchronizer
private IServerImplementationFactory m_serverImplementationFactory
Constructor Detail |
---|
public GenericServer(int a_serverPort, java.net.InetAddress a_serverAddress)
a_serverPort
- The port the server will listen on.a_serverAddress
- The local address the server will be bind on. If this value is null,
the server will accept requests on all local addresses.Method Detail |
---|
public void startServer() throws java.io.IOException
java.io.IOException
public void stopServer()
public void setConnectionHandlerFactory(IServerImplementationFactory a_serverImplementationFactory)
a_serverImplementationFactory
- The new server implementation factory. If this value is
null, any new arriving connection is not handled and is
closed immediately.public void run()
run
in interface java.lang.Runnable
private IServerImplementationFactory getServerImplementationFactory()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |