static class TimeWindowStatisticsImpl.Builder<V>
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private long |
interval
Total interval for which these statistics are calculated (eg.
|
private TimeReservoir<V> |
timeReservoir |
Constructor and Description |
---|
Builder(TimeReservoir<V> timeReservoir)
Create new time window statistics builder instance.
|
Modifier and Type | Method and Description |
---|---|
(package private) void |
addRequest(long requestTime,
V duration)
Add request execution.
|
(package private) TimeWindowStatisticsImpl |
build()
Build the time window statistics instance.
|
(package private) TimeWindowStatisticsImpl |
build(long currentTime)
Build the time window statistics instance.
|
long |
getInterval() |
private TimeWindowStatisticsImpl |
getOrCreateEmptyStats(long interval) |
private final long interval
private final TimeReservoir<V> timeReservoir
Builder(TimeReservoir<V> timeReservoir)
timeReservoir
- statistically representative reservoir of long values data stream in time.void addRequest(long requestTime, V duration)
requestTime
- Time of execution.duration
- Duration of request processing.TimeWindowStatisticsImpl build()
TimeWindowStatisticsImpl build(long currentTime)
currentTime
- Current time as a reference to which the statistics should be built.private TimeWindowStatisticsImpl getOrCreateEmptyStats(long interval)
public long getInterval()