ehcache

net.sf.ehcache.util.counter.sampled
Class SampledCounterConfig

java.lang.Object
  extended by net.sf.ehcache.util.counter.CounterConfig
      extended by net.sf.ehcache.util.counter.sampled.SampledCounterConfig
Direct Known Subclasses:
SampledRateCounterConfig

public class SampledCounterConfig
extends CounterConfig

Config for a SampledCounter

Since:
1.7
Author:
Abhishek Sanoujam

Constructor Summary
SampledCounterConfig(int intervalSecs, int historySize, boolean isResetOnSample, long initialValue)
          Make a new timed counter config (duh)
 
Method Summary
 Counter createCounter()
          Creates and returns a Counter based on the initial value
 int getHistorySize()
          Returns the history size
 int getIntervalSecs()
          Returns the interval time (seconds)
 boolean isResetOnSample()
          Returns true if counters created from this config will reset on each sample
 
Methods inherited from class net.sf.ehcache.util.counter.CounterConfig
getInitialValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SampledCounterConfig

public SampledCounterConfig(int intervalSecs,
                            int historySize,
                            boolean isResetOnSample,
                            long initialValue)
Make a new timed counter config (duh)

Parameters:
intervalSecs - the interval (in seconds) between sampling
historySize - number of counter samples that will be retained in memory
isResetOnSample - true if the counter should be reset to 0 upon each sample
initialValue - the initial value given to this counter
Method Detail

getHistorySize

public int getHistorySize()
Returns the history size

Returns:
The history size

getIntervalSecs

public int getIntervalSecs()
Returns the interval time (seconds)

Returns:
Interval of the sampling thread in seconds

isResetOnSample

public boolean isResetOnSample()
Returns true if counters created from this config will reset on each sample

Returns:
true if values are reset to the initial value after each sample

createCounter

public Counter createCounter()
Creates and returns a Counter based on the initial value

Overrides:
createCounter in class CounterConfig
Returns:
The counter created by this config

ehcache

Copyright 2001-2015, Terracotta, Inc.