public class ForwardScheduler
extends java.lang.Object
implements java.lang.Runnable
Modifier and Type | Field and Description |
---|---|
private static long |
CYCLE_TIME
This is the time between two allocation rounds in milliseconds.
|
private java.util.Vector |
m_connectionHandler
This stores all active connections (ForwardConnection).
|
private int |
m_netBandwidth
The maximum bandwidth for all connections together in bytes/second.
|
private int |
m_nrOfConnections
This stores the maximum number of simultaneous connections.
|
private java.lang.Thread |
m_schedulerThread
This stores the internal scheduling thread.
|
private java.util.Hashtable |
m_serverManagers
This stores the associated ServerManagers (ID as keys and the instances as values) managing
the server sockets of this ForwardScheduler.
|
private boolean |
m_shutdown
This value is set to true, for signaling the shutdown of this ForwardScheduler to the
internal thread.
|
private ForwardSchedulerStatistics |
m_statistics
This stores the statistics for the ForwardScheduler.
|
Constructor and Description |
---|
ForwardScheduler()
Creates a new ForwardScheduler.
|
Modifier and Type | Method and Description |
---|---|
void |
addServerManager(IServerManager a_serverManager)
Adds a ServerManager to the list of associated ServerManagers.
|
int |
getCurrentlyForwardedConnections()
Returns the number of currently forwarded connections.
|
int |
getGuaranteedBandwidth()
Returns the guaranteed bandwidth for one connection in bytes/sec.
|
int |
getMaximumBandwidth()
Returns the maximum bandwidth a connection can use in bytes/sec.
|
ForwardSchedulerStatistics |
getStatistics()
Returns the statistics instance for this ForwardScheduler.
|
void |
handleNewConnection(IStreamConnection a_newConnection)
The associated ServerManager signals any new connection here.
|
void |
removeAllServerManagers()
Removes all ServerManagers from the list of associated ServerManagers of this
ForwardScheduler.
|
void |
removeConnection(ForwardConnection a_connectionToRemove)
This method is called from a ForwardConnection to signal, that the connection is closed
and can be removed from the connection store of all forwarded connections.
|
void |
removeServerManager(java.lang.Object a_serverManagerId)
Removes one ServerManager from the list of associated ServerManagers of this
ForwardScheduler.
|
void |
run()
This is the implementation of the internal thread.
|
void |
setMaximumNumberOfConnections(int a_maximumNumberOfConnections)
Changes the number of simultaneously forwarded client connections.
|
void |
setNetBandwidth(int a_netBandwidth)
Changes the maximum bandwidth (net bandwidth, without TCP/IP headers...) which can be used
by all client connections together.
|
void |
shutdown()
This method must be called, if the ForwardScheduler shall come to an end.
|
private static final long CYCLE_TIME
private int m_nrOfConnections
private int m_netBandwidth
private java.util.Vector m_connectionHandler
ForwardConnection
private boolean m_shutdown
run()
private java.lang.Thread m_schedulerThread
private java.util.Hashtable m_serverManagers
ServerManager
private ForwardSchedulerStatistics m_statistics
public ForwardScheduler()
public void handleNewConnection(IStreamConnection a_newConnection)
a_newConnection
- The new connection.public void removeConnection(ForwardConnection a_connectionToRemove)
a_connectionToRemove
- The closed connection which can be removed.public void shutdown()
public int getMaximumBandwidth()
public int getGuaranteedBandwidth()
public void setMaximumNumberOfConnections(int a_maximumNumberOfConnections)
public void setNetBandwidth(int a_netBandwidth)
a_netBandwidth
- The maximum bandwidth for all client connections together (= average
upstream = average downstream) in bytes/sec.public void addServerManager(IServerManager a_serverManager) throws java.lang.Exception
a_serverManager
- The ServerManager to add.java.lang.Exception
public void removeServerManager(java.lang.Object a_serverManagerId)
a_serverManagerId
- The ID of the ServerManager to close, see IServerManager.getId().public void removeAllServerManagers()
public ForwardSchedulerStatistics getStatistics()
public int getCurrentlyForwardedConnections()
public void run()
run
in interface java.lang.Runnable
Copyright © 2023. All rights reserved.