org.terracotta.statistics.extended
Class RateImpl<T extends Enum<T>>

java.lang.Object
  extended by org.terracotta.statistics.extended.RateImpl<T>
Type Parameters:
T - the generic type
All Implemented Interfaces:
SampledStatistic<Double>

public class RateImpl<T extends Enum<T>>
extends Object
implements SampledStatistic<Double>

The Class RateStatistic.

Author:
cdennis

Constructor Summary
RateImpl(OperationStatistic<T> source, Set<T> targets, long averagePeriod, TimeUnit averageTimeUnit, ScheduledExecutorService executor, int historySize, long historyPeriod, TimeUnit historyTimeUnit)
          Instantiates a new rate statistic.
 
Method Summary
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RateImpl

public RateImpl(OperationStatistic<T> source,
                Set<T> targets,
                long averagePeriod,
                TimeUnit averageTimeUnit,
                ScheduledExecutorService executor,
                int historySize,
                long historyPeriod,
                TimeUnit historyTimeUnit)
Instantiates a new rate statistic.

Parameters:
targets - the targets
averagePeriod - the average period
executor - the executor
historySize - the history size
historyPeriod - the history period
Method Detail

active

public boolean active()
Description copied from interface: SampledStatistic
Active.

Specified by:
active in interface SampledStatistic<Double>
Returns:
true, if successful

value

public Double value()
Description copied from interface: SampledStatistic
Value.

Specified by:
value in interface SampledStatistic<Double>
Returns:
the t

history

public List<Timestamped<Double>> history()
Description copied from interface: SampledStatistic
History.

Specified by:
history in interface SampledStatistic<Double>
Returns:
the list

start

protected void start()
Start sampling.


setWindow

protected void setWindow(long averagePeriod,
                         TimeUnit averageTimeUnit)
Sets the window.

Parameters:
averagePeriod - the new window
averageTimeUnit - the new window's time unit

setHistory

protected void setHistory(int historySize,
                          long historyPeriod,
                          TimeUnit historyTimeUnit)
Set the sample history parameters.

Parameters:
historySize - history sample size
historyPeriod - history sample period
historyTimeUnit - history time unit

expire

protected boolean expire(long expiry)
Check the statistic for expiry.

Parameters:
expiry - expiry threshold
Returns:
true if expired


Copyright © 2016. All Rights Reserved.