org.iges.anagram.filter
Class AbuseFilter.HitLimiter

java.lang.Object
  |
  +--org.iges.anagram.filter.AbuseFilter.HitLimiter
All Implemented Interfaces:
java.io.Serializable
Enclosing class:
AbuseFilter

protected class AbuseFilter.HitLimiter
extends java.lang.Object
implements java.io.Serializable

Tracks hits/hour, and switches to a blocked state if the number exceeds a given threshold.

See Also:
Serialized Form

Method Summary
 void addHit(long now)
          Registers a hit at the time given
 boolean exceeded(long now, long hitLimit)
          Checks whether the hit limit has been exceeded
 java.lang.String getMessage(long timeoutMins)
           
 boolean isBlocked(long now, long timeoutMins)
          Checks whether a block is in force
 boolean isStale(long now, long staleTime)
          Indicates whether this limiter has had a hit recently.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getMessage

public java.lang.String getMessage(long timeoutMins)

isBlocked

public boolean isBlocked(long now,
                         long timeoutMins)
Checks whether a block is in force


exceeded

public boolean exceeded(long now,
                        long hitLimit)
Checks whether the hit limit has been exceeded


isStale

public boolean isStale(long now,
                       long staleTime)
Indicates whether this limiter has had a hit recently.


addHit

public void addHit(long now)
Registers a hit at the time given