com.interface21.util
Class ResponseTimeMonitorImpl

java.lang.Object
  |
  +--com.interface21.util.ResponseTimeMonitorImpl
All Implemented Interfaces:
ResponseTimeMonitor

public class ResponseTimeMonitorImpl
extends java.lang.Object
implements ResponseTimeMonitor

Implementation of ResponseTimeMonitor for use via delegation by objects that implement this interface.
Uses no synchronization, so is suitable for use in a web application.

Since:
November 21, 2000
Author:
Rod Johnson

Constructor Summary
ResponseTimeMonitorImpl()
          Creates a new ResponseTimeMonitorImpl.
 
Method Summary
 int getAccessCount()
          Return the number of hits this object has handled
 int getAverageResponseTimeMillis()
          Return the average response time achieved by this object
 int getBestResponseTimeMillis()
          Return the best (lowest) response time achieved by this object
 java.util.Date getLoadDate()
          Return the date when this object was loaded
 long getUptime()
          Return the number of milliseconds since this object was loaded
 int getWorstResponseTimeMillis()
          Return the worst (slowest) response time achieved by this object
 void recordResponseTime(long responseTime)
          Utility method to record this response time, updating the best and worst response times if necessary
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ResponseTimeMonitorImpl

public ResponseTimeMonitorImpl()
Creates a new ResponseTimeMonitorImpl.
Method Detail

getAccessCount

public final int getAccessCount()
Return the number of hits this object has handled
Specified by:
getAccessCount in interface ResponseTimeMonitor
Returns:
the number of hits this object has handled

getUptime

public final long getUptime()
Return the number of milliseconds since this object was loaded
Returns:
the number of milliseconds since this object was loaded

getLoadDate

public final java.util.Date getLoadDate()
Return the date when this object was loaded
Returns:
the date when this object was loaded

getAverageResponseTimeMillis

public final int getAverageResponseTimeMillis()
Return the average response time achieved by this object
Specified by:
getAverageResponseTimeMillis in interface ResponseTimeMonitor
Returns:
the average response time achieved by this object

getBestResponseTimeMillis

public final int getBestResponseTimeMillis()
Return the best (lowest) response time achieved by this object
Specified by:
getBestResponseTimeMillis in interface ResponseTimeMonitor
Returns:
the best (lowest) response time achieved by this object

getWorstResponseTimeMillis

public final int getWorstResponseTimeMillis()
Return the worst (slowest) response time achieved by this object
Specified by:
getWorstResponseTimeMillis in interface ResponseTimeMonitor
Returns:
the worst (slowest) response time achieved by this object

recordResponseTime

public final void recordResponseTime(long responseTime)
Utility method to record this response time, updating the best and worst response times if necessary
Parameters:
responseTime - the response time of this request

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
Returns:
a human-readable string showing the performance data recorded by this object.


Rod Johnson and Spring contributors 2001-2003.