java.lang.Object
net.i2p.router.web.GraphGenerator.ReportThrottle
- Enclosing class:
GraphGenerator
Decide whether a repeated report is due, and remember the decision.
Pure enough to unit test and free of router context, so the "first report is never throttled, a changed one is never delayed, an unchanged one repeats on a timer" rule is pinned by tests rather than by reading the caller.
Constructor Summary
ConstructorsConstructorDescriptionOne per reported condition, so each carries its own last report and signature.Method Summary
All MethodsModifier and TypeMethodDescription(package private) booleanallow(long now, long signature, long minIntervalMs) Decide whether this report is due, and remember the decision.
Constructor Details
ReportThrottle
ReportThrottle()One per reported condition, so each carries its own last report and signature.
Method Details
allow
boolean allow(long now, long signature, long minIntervalMs) Decide whether this report is due, and remember the decision.Synchronized because the stall report is reached from the 90s sync task and the 10s watchdog, which run on different threads.
- Parameters:
now- current wall-clock mssignature- value identifying the state being reportedminIntervalMs- shortest gap between two identical reports- Returns:
- true if the caller should log now