org.directwebremoting.util
Class HitMonitor

java.lang.Object
  extended by org.directwebremoting.util.HitMonitor

public class HitMonitor
extends java.lang.Object

We need a way to record how heavily used the server is, and adjust our behavior to reduce the load on the server.

Author:
Joe Walker [joe at getahead dot ltd dot uk]

Constructor Summary
HitMonitor(int seconds)
          Create a HitMonitor that records the number of hits in the last n milliseconds.
 
Method Summary
 int getHitsInLastPeriod()
          How to detect the number of hits in the time period specified in the constructor.
 void recordHit()
          A hit has happened, record some load on the server
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HitMonitor

public HitMonitor(int seconds)
Create a HitMonitor that records the number of hits in the last n milliseconds.

Parameters:
seconds - The number of seconds to record hits for
Method Detail

recordHit

public void recordHit()
A hit has happened, record some load on the server


getHitsInLastPeriod

public int getHitsInLastPeriod()
How to detect the number of hits in the time period specified in the constructor.

Returns:
The hit count