Class SampledCounterProxy<E extends java.lang.Number>

  • 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
    • Constructor Detail

      • SampledCounterProxy

        public SampledCounterProxy​(ExtendedStatistics.Statistic<E> rate)
        Instantiates a new sampled counter proxy.
        Parameters:
        rate - the rate
    • Method Detail

      • 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
      • 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