public class SentTimeCache
extends java.lang.Object
sent(int)
was invoked are dropped on a first-in first-out basis.Constructor and Description |
---|
SentTimeCache(int maxSize)
Constructs a sent time cache with the given maximal capacity.
|
Modifier and Type | Method and Description |
---|---|
long |
queryAndRemove(int seqnum)
Queries the sent time for the given sequence number and removes it from the cache.
|
void |
report(int seqnum,
long time)
Reports the given sequence number as being sent at the given time.
|
void |
sent(int seqnum)
Convenience wrapper for
report(int, long) . |
public SentTimeCache(int maxSize)
public void report(int seqnum, long time)
seqnum
- the sequence numbertime
- the sent time in millisecondspublic void sent(int seqnum)
report(int, long)
.
Reports the given sequence number as being sent right now. If the cache is at full capacity,
this will lead to the oldest entry being dropped. If the sequence number was already in this
cache, the current time will be associated with the sequence number, but the order in which
sequence numbers are dropped from the cache will not be affected.seqnum
- the sequence numberreport(int, long)
public long queryAndRemove(int seqnum)
seqnum
- the sequence number