Class SampledCounterProxy<E extends java.lang.Number>
- java.lang.Object
-
- net.sf.ehcache.management.sampled.SampledCounterProxy<E>
-
- Type Parameters:
E- the element type
- All Implemented Interfaces:
Counter,SampledCounter
- Direct Known Subclasses:
SampledRateCounterProxy
public class SampledCounterProxy<E extends java.lang.Number> extends java.lang.Object implements SampledCounter
The Class SampledCounterProxy.- Author:
- cschanck
-
-
Field Summary
Fields Modifier and Type Field Description protected ExtendedStatistics.Statistic<E>rateThe rate.
-
Constructor Summary
Constructors Constructor Description SampledCounterProxy(ExtendedStatistics.Statistic<E> rate)Instantiates a new sampled counter proxy.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description longdecrement()Decrement the counter by 1longdecrement(long amount)Decrement the counter by given amountTimeStampedCounterValue[]getAllSampleValues()Returns all samples in historylonggetAndReset()Returns the current value of the counter and resets it to 0longgetAndSet(long newValue)Returns the value of the counter and sets it to the new valueTimeStampedCounterValuegetMostRecentSample()Returns the most recent sampled valuelonggetValue()Gets current value of the counterlongincrement()Increment the counter by 1longincrement(long amount)Increment the counter by given amountvoidsetValue(long newValue)Sets the value of the counter to the supplied valuevoidshutdown()Shutdown this counterprotected TimeStampedCounterValue[]sortAndPresent(java.util.List<TimeStampedCounterValue> arr)Sort and present the List of values
-
-
-
Field Detail
-
rate
protected final ExtendedStatistics.Statistic<E extends java.lang.Number> rate
The rate.
-
-
Constructor Detail
-
SampledCounterProxy
public SampledCounterProxy(ExtendedStatistics.Statistic<E> rate)
Instantiates a new sampled counter proxy.- Parameters:
rate- the rate
-
-
Method Detail
-
getMostRecentSample
public TimeStampedCounterValue getMostRecentSample()
Description copied from interface:SampledCounterReturns the most recent sampled value- Specified by:
getMostRecentSamplein interfaceSampledCounter- Returns:
- Value of the most recent sampled value
-
getAllSampleValues
public TimeStampedCounterValue[] getAllSampleValues()
Description copied from interface:SampledCounterReturns all samples in history- Specified by:
getAllSampleValuesin interfaceSampledCounter- Returns:
- An array containing the TimeStampedCounterValue's
-
sortAndPresent
protected TimeStampedCounterValue[] sortAndPresent(java.util.List<TimeStampedCounterValue> arr)
Sort and present the List of values- Parameters:
arr-- Returns:
-
setValue
public void setValue(long newValue)
Description copied from interface:CounterSets the value of the counter to the supplied value
-
increment
public long increment()
Description copied from interface:CounterIncrement the counter by 1
-
decrement
public long decrement()
Description copied from interface:CounterDecrement the counter by 1
-
getAndSet
public long getAndSet(long newValue)
Description copied from interface:CounterReturns the value of the counter and sets it to the new value
-
getValue
public long getValue()
Description copied from interface:CounterGets current value of the counter
-
increment
public long increment(long amount)
Description copied from interface:CounterIncrement the counter by given amount
-
decrement
public long decrement(long amount)
Description copied from interface:CounterDecrement the counter by given amount
-
shutdown
public void shutdown()
Description copied from interface:SampledCounterShutdown this counter- Specified by:
shutdownin interfaceSampledCounter
-
getAndReset
public long getAndReset()
Description copied from interface:SampledCounterReturns the current value of the counter and resets it to 0- Specified by:
getAndResetin interfaceSampledCounter- Returns:
- current value of the counter
-
-