java.lang.Object
net.i2p.i2ptunnel.access.AccessCounter
Access attempt counter.
Field Summary
Constructor Summary
ConstructorsMethod Summary
All MethodsModifier and TypeMethodDescription(package private) booleanisBreached(Threshold threshold, long now) Check if the given threshold has been breached.(package private) booleanpurge(long olderThan) Purges old accesses from the list.(package private) voidrecordAccess(long now) Records that a connection attempt was made.
Field Details
accesses
Constructor Details
AccessCounter
AccessCounter()Create a new access counter.
Method Details
recordAccess
void recordAccess(long now) Records that a connection attempt was made.- Parameters:
now- the current time in milliseconds, as returned byClock.now(), stored as this access's timestamp
isBreached
Check if the given threshold has been breached.- Parameters:
threshold- definition of a thresholdnow- the current time in milliseconds, as returned byClock.now(), used to age recorded accesses against the threshold's window- Returns:
- true if the given threshold has been breached
purge
boolean purge(long olderThan) Purges old accesses from the list.- Parameters:
olderThan- remove all accesses older than the given timestamp- Returns:
- true if there is nothing left in the access history