T
- the generic typepublic class RateImpl<T extends Enum<T>> extends Object implements SampledStatistic<Double>
Constructor and Description |
---|
RateImpl(OperationStatistic<T> source,
Set<T> targets,
long averagePeriod,
TimeUnit averageTimeUnit,
ScheduledExecutorService executor,
int historySize,
long historyPeriod,
TimeUnit historyTimeUnit)
Instantiates a new rate statistic.
|
Modifier and Type | Method and Description |
---|---|
boolean |
active()
Active.
|
protected boolean |
expire(long expiry)
Check the statistic for expiry.
|
List<Timestamped<Double>> |
history()
History.
|
protected void |
setHistory(int historySize,
long historyPeriod,
TimeUnit historyTimeUnit)
Set the sample history parameters.
|
protected void |
setWindow(long averagePeriod,
TimeUnit averageTimeUnit)
Sets the window.
|
protected void |
start()
Start sampling.
|
Double |
value()
Value.
|
public RateImpl(OperationStatistic<T> source, Set<T> targets, long averagePeriod, TimeUnit averageTimeUnit, ScheduledExecutorService executor, int historySize, long historyPeriod, TimeUnit historyTimeUnit)
targets
- the targetsaveragePeriod
- the average periodexecutor
- the executorhistorySize
- the history sizehistoryPeriod
- the history periodpublic boolean active()
SampledStatistic
active
in interface SampledStatistic<Double>
public Double value()
SampledStatistic
value
in interface SampledStatistic<Double>
public List<Timestamped<Double>> history()
SampledStatistic
history
in interface SampledStatistic<Double>
protected void start()
protected void setWindow(long averagePeriod, TimeUnit averageTimeUnit)
averagePeriod
- the new windowaverageTimeUnit
- the new window's time unitprotected void setHistory(int historySize, long historyPeriod, TimeUnit historyTimeUnit)
historySize
- history sample sizehistoryPeriod
- history sample periodhistoryTimeUnit
- history time unitprotected boolean expire(long expiry)
expiry
- expiry thresholdtrue
if expiredCopyright © 2016. All rights reserved.