public class ServerSocketManager extends java.lang.Object implements java.lang.Runnable, IServerManager
Modifier and Type | Field and Description |
---|---|
private java.lang.Thread |
m_managerThread
The internal thread, which accepts the client connections and forwards them to the
ForwardScheduler.
|
private ForwardScheduler |
m_parentScheduler
This is the ForwardScheduler, which owns this ServerManager.
|
private int |
m_portNumber
This is the portnumber the ServerSocket listens on.
|
private java.net.ServerSocket |
m_serverSocket
The associated ServerSocket which listens for all client connections.
|
private static int |
MAXIMUM_CONNECTION_REQUESTS
This is the maximum number of unanswered connection requests (connections, which are not
accepted yet).
|
Constructor and Description |
---|
ServerSocketManager(int a_portNumber)
This creates a new ServerManager.
|
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
getId()
Returns the ID of this ServerSocketManager.
|
void |
run()
This is the implementation of the internal thread.
|
void |
shutdown()
This method must be called, if the ServerManager shall come to an end.
|
void |
startServerManager(ForwardScheduler a_parentScheduler)
This starts the ServerManager.
|
private static final int MAXIMUM_CONNECTION_REQUESTS
private java.net.ServerSocket m_serverSocket
private java.lang.Thread m_managerThread
private ForwardScheduler m_parentScheduler
private int m_portNumber
public ServerSocketManager(int a_portNumber)
a_portNumber
- The port of the listening server socket. This is the port where clients
can connect to.public java.lang.Object getId()
getId
in interface IServerManager
public void startServerManager(ForwardScheduler a_parentScheduler) throws java.lang.Exception
startServerManager
in interface IServerManager
a_parentScheduler
- This is the ForwardScheduler where all new connections are reported
to.java.lang.Exception
public void shutdown()
shutdown
in interface IServerManager
public void run()
run
in interface java.lang.Runnable
Copyright © 2023. All rights reserved.