Package org.apache.commons.pool2.impl
Class BaseGenericObjectPool.StatsStore
java.lang.Object
org.apache.commons.pool2.impl.BaseGenericObjectPool.StatsStore
- Enclosing class:
- BaseGenericObjectPool<T>
Maintains a cache of values for a single metric and reports
statistics on the cached values.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate intprivate static final intprivate final intprivate final AtomicLong[] -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) voidadd(long value) Adds a value to the cache.(package private) voidlonggetMean()Gets the mean of the cached values.(package private) DurationGets the mean Duration of the cached values.(package private) List<AtomicLong>Gets the current values as a List.toString()
-
Field Details
-
NONE
private static final int NONE- See Also:
-
values
-
size
private final int size -
index
private int index
-
-
Constructor Details
-
StatsStore
StatsStore(int size) Constructs a new instance with the given cache size.- Parameters:
size- number of values to maintain in the cache.
-
-
Method Details
-
add
-
add
void add(long value) Adds a value to the cache. If the cache is full, one of the existing values is replaced by the new value.- Parameters:
value- new value to add to the cache.
-
getMean
public long getMean()Gets the mean of the cached values.- Returns:
- the mean of the cache, truncated to long
-
getMeanDuration
Duration getMeanDuration()Gets the mean Duration of the cached values.- Returns:
- the mean Duration of the cache, truncated to long milliseconds of a Duration.
-
getValues
List<AtomicLong> getValues()Gets the current values as a List.- Returns:
- the current values as a List.
-
toString
-