ehcache

net.sf.ehcache.management.sampled
Class SampledCounterProxy<E extends Number>

java.lang.Object
  extended by 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 Number>
extends Object
implements SampledCounter

The Class SampledCounterProxy.

Author:
cschanck

Field Summary
protected  ExtendedStatistics.Statistic<E> rate
          The rate.
 
Constructor Summary
SampledCounterProxy(ExtendedStatistics.Statistic<E> rate)
          Instantiates a new sampled counter proxy.
 
Method Summary
 long decrement()
          Decrement the counter by 1
 long decrement(long amount)
          Decrement the counter by given amount
 TimeStampedCounterValue[] getAllSampleValues()
          Returns all samples in history
 long getAndReset()
          Returns the current value of the counter and resets it to 0
 long getAndSet(long newValue)
          Returns the value of the counter and sets it to the new value
 TimeStampedCounterValue getMostRecentSample()
          Returns the most recent sampled value
 long getValue()
          Gets current value of the counter
 long increment()
          Increment the counter by 1
 long increment(long amount)
          Increment the counter by given amount
 void setValue(long newValue)
          Sets the value of the counter to the supplied value
 void shutdown()
          Shutdown this counter
protected  TimeStampedCounterValue[] sortAndPresent(List<TimeStampedCounterValue> arr)
          Sort and present the List of values
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

rate

protected final ExtendedStatistics.Statistic<E extends 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: SampledCounter
Returns the most recent sampled value

Specified by:
getMostRecentSample in interface SampledCounter
Returns:
Value of the most recent sampled value

getAllSampleValues

public TimeStampedCounterValue[] getAllSampleValues()
Description copied from interface: SampledCounter
Returns all samples in history

Specified by:
getAllSampleValues in interface SampledCounter
Returns:
An array containing the TimeStampedCounterValue's

sortAndPresent

protected TimeStampedCounterValue[] sortAndPresent(List<TimeStampedCounterValue> arr)
Sort and present the List of values

Parameters:
arr -
Returns:

setValue

public void setValue(long newValue)
Description copied from interface: Counter
Sets the value of the counter to the supplied value

Specified by:
setValue in interface Counter

increment

public long increment()
Description copied from interface: Counter
Increment the counter by 1

Specified by:
increment in interface Counter
Returns:
the value after incrementing

decrement

public long decrement()
Description copied from interface: Counter
Decrement the counter by 1

Specified by:
decrement in interface Counter
Returns:
the value after decrementing

getAndSet

public long getAndSet(long newValue)
Description copied from interface: Counter
Returns the value of the counter and sets it to the new value

Specified by:
getAndSet in interface Counter
Returns:
Returns the old value

getValue

public long getValue()
Description copied from interface: Counter
Gets current value of the counter

Specified by:
getValue in interface Counter
Returns:
current value of the counter

increment

public long increment(long amount)
Description copied from interface: Counter
Increment the counter by given amount

Specified by:
increment in interface Counter
Returns:
the value of the counter after incrementing

decrement

public long decrement(long amount)
Description copied from interface: Counter
Decrement the counter by given amount

Specified by:
decrement in interface Counter
Returns:
the value of the counter after decrementing

shutdown

public void shutdown()
Description copied from interface: SampledCounter
Shutdown this counter

Specified by:
shutdown in interface SampledCounter

getAndReset

public long getAndReset()
Description copied from interface: SampledCounter
Returns the current value of the counter and resets it to 0

Specified by:
getAndReset in interface SampledCounter
Returns:
current value of the counter

ehcache

Copyright 2001-2017, Terracotta, Inc.