org.terracotta.statistics.extended
Class SemiExpiringSampledStatistic<T extends Number>

java.lang.Object
  extended by org.terracotta.statistics.extended.SemiExpiringSampledStatistic<T>
Type Parameters:
T - statistic type
All Implemented Interfaces:
SampledStatistic<T>

public class SemiExpiringSampledStatistic<T extends Number>
extends Object

Statistic implementation that stops sampling history if the last history access is before a user supplied timestamp.

Author:
Chris Dennis

Constructor Summary
SemiExpiringSampledStatistic(ValueStatistic<T> source, ScheduledExecutorService executor, int historySize, long historyTime, TimeUnit historyTimeUnit)
          Creates a new semi-expiring statistic.
 
Method Summary
 boolean active()
          Active.
protected  boolean expire(long expiry)
          Expire.
 List<Timestamped<T>> history()
          History.
protected  void start()
          Start.
protected  void startStatistic()
          Start statistic.
protected  void stopStatistic()
          Stop statistic.
protected  void touch()
          Touch.
 T value()
          Value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SemiExpiringSampledStatistic

public SemiExpiringSampledStatistic(ValueStatistic<T> source,
                                    ScheduledExecutorService executor,
                                    int historySize,
                                    long historyTime,
                                    TimeUnit historyTimeUnit)
Creates a new semi-expiring statistic.

Parameters:
source - statistic source
executor - executor to use for sampling
historySize - size of sample history
historyTime - period between samples
historyTimeUnit - unit of period between samples
Method Detail

history

public List<Timestamped<T>> history()
History.

Specified by:
history in interface SampledStatistic<T extends Number>
Returns:
the list

active

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

Returns:
true, if successful

touch

protected final void touch()
Touch.


start

protected final void start()
Start.


expire

protected final boolean expire(long expiry)
Expire.

Parameters:
expiry - the expiry
Returns:
true, if successful

stopStatistic

protected void stopStatistic()
Stop statistic.


startStatistic

protected void startStatistic()
Start statistic.


value

public T value()
Value.

Specified by:
value in interface SampledStatistic<T extends Number>
Returns:
the t


Copyright © 2015. All Rights Reserved.