Class BaseGenericObjectPool.StatsStore

  • Enclosing class:
    BaseGenericObjectPool<T>

    private static final class BaseGenericObjectPool.StatsStore
    extends java.lang.Object
    Maintains a cache of values for a single metric and reports statistics on the cached values.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private int index  
      private static int NONE  
      private int size  
      private java.util.concurrent.atomic.AtomicLong[] values  
    • Constructor Summary

      Constructors 
      Constructor Description
      StatsStore​(int size)
      Constructs a new instance with the given cache size.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      (package private) void add​(long value)
      Adds a value to the cache.
      (package private) void add​(java.time.Duration value)  
      long getMean()
      Gets the mean of the cached values.
      (package private) java.time.Duration getMeanDuration()
      Gets the mean Duration of the cached values.
      (package private) java.util.List<java.util.concurrent.atomic.AtomicLong> getValues()
      Gets the current values as a List.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • values

        private final java.util.concurrent.atomic.AtomicLong[] values
      • size

        private final int size
      • index

        private int index
    • Constructor Detail

      • StatsStore

        StatsStore​(int size)
        Constructs a new instance with the given cache size.
        Parameters:
        size - number of values to maintain in the cache.
    • Method Detail

      • add

        void add​(java.time.Duration value)
      • 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

        java.time.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

        java.util.List<java.util.concurrent.atomic.AtomicLong> getValues()
        Gets the current values as a List.
        Returns:
        the current values as a List.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object