forward.server
Class ForwardSchedulerStatistics

java.lang.Object
  extended by forward.server.ForwardSchedulerStatistics

public class ForwardSchedulerStatistics
extends java.lang.Object

This is the implementation for the statistics of a ForwardScheduler.


Field Summary
private static long BANDWIDTH_STATISTICS_INTERVAL
          The backwards interval in milliseconds over which the current bandwidth usage statistics are created.
private  int m_acceptedConnections
          Stores the number of accepted connections.
private  java.util.Vector m_lastTransferVolumes
          Stores the list with the last transfered byte amounts.
private  int m_rejectedConnections
          Stores the number of rejected connections.
private  long m_transferedBytes
          Stores the number of transfered bytes.
 
Constructor Summary
ForwardSchedulerStatistics()
          Creates a new ForwardSchedulerStatistics instance.
 
Method Summary
 int getAcceptedConnections()
          Returns the number of accepted connections.
 int getCurrentBandwidthUsage()
          Returns the current bandwidth usage.
 int getRejectedConnections()
          Returns the number of rejected connections.
 long getTransferedBytes()
          Returns the total number of transfered bytes.
 void incrementAcceptedConnections()
          Increments the number of accepted connections by one.
 void incrementRejectedConnections()
          Increments the number of rejected connections by one.
 void incrementTransferVolume(int a_volume)
          Increments the number of transfered bytes and adds the transfer volume to the list of volumes for calculating the current bandwidth usage.
private  void removeOutdatedTransferVolumes()
          Removes all outdated values from the list of currently transfered volumes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BANDWIDTH_STATISTICS_INTERVAL

private static final long BANDWIDTH_STATISTICS_INTERVAL
The backwards interval in milliseconds over which the current bandwidth usage statistics are created.

See Also:
Constant Field Values

m_rejectedConnections

private int m_rejectedConnections
Stores the number of rejected connections.


m_acceptedConnections

private int m_acceptedConnections
Stores the number of accepted connections.


m_transferedBytes

private long m_transferedBytes
Stores the number of transfered bytes.


m_lastTransferVolumes

private java.util.Vector m_lastTransferVolumes
Stores the list with the last transfered byte amounts. See the constant in this class to see how long every amount is in that list to create the bandwidth usage statistics.

Constructor Detail

ForwardSchedulerStatistics

public ForwardSchedulerStatistics()
Creates a new ForwardSchedulerStatistics instance.

Method Detail

incrementRejectedConnections

public void incrementRejectedConnections()
Increments the number of rejected connections by one.


getRejectedConnections

public int getRejectedConnections()
Returns the number of rejected connections.

Returns:
The number of rejected connections.

incrementAcceptedConnections

public void incrementAcceptedConnections()
Increments the number of accepted connections by one.


getAcceptedConnections

public int getAcceptedConnections()
Returns the number of accepted connections.

Returns:
The number of accepted connections.

incrementTransferVolume

public void incrementTransferVolume(int a_volume)
Increments the number of transfered bytes and adds the transfer volume to the list of volumes for calculating the current bandwidth usage. Also outdated values from that list are removed.

Parameters:
a_volume - A number of currently transfered bytes.

getCurrentBandwidthUsage

public int getCurrentBandwidthUsage()
Returns the current bandwidth usage. It is calculated from the list of currently transfered volumes. See the constant in this class to get the time how long backwards the list stores every transfer volume. First all outdated volumes are removed from the list and the rest is used for calculating the current bandwidth usage.

Returns:
The current bandwidth usage in bytes/sec.

getTransferedBytes

public long getTransferedBytes()
Returns the total number of transfered bytes.

Returns:
The total number of transfered bytes.

removeOutdatedTransferVolumes

private void removeOutdatedTransferVolumes()
Removes all outdated values from the list of currently transfered volumes.