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.
Field Summary
FieldsModifier and TypeFieldDescriptionprivate longRender time of the last graph, in ms.private longSignature of the last rendered data.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.
Field Details
_lastMs
private long _lastMsRender time of the last graph, in ms._lastSignature
private long _lastSignatureSignature of the last rendered data.
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