Class SemiExpiringStatistic<T extends java.lang.Number>

  • Type Parameters:
    T - statistic type
    All Implemented Interfaces:
    ExtendedStatistics.Statistic<T>

    public class SemiExpiringStatistic<T extends java.lang.Number>
    extends java.lang.Object
    Statistic implementation that stops sampling history if the last history access is before a user supplied timestamp.
    Author:
    Chris Dennis
    • Constructor Summary

      Constructors 
      Constructor Description
      SemiExpiringStatistic​(org.terracotta.statistics.ValueStatistic<T> source, java.util.concurrent.ScheduledExecutorService executor, int historySize, long historyNanos)
      Creates a new semi-expiring statistic.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean active()
      Active.
      protected boolean expire​(long expiry)
      Expire.
      java.util.List<org.terracotta.statistics.archive.Timestamped<T>> history()
      History.
      protected void start()
      Start.
      protected void startStatistic()
      Start statistic.
      protected void stopStatistic()
      Stop statistic.
      protected void touch()
      Touch.
      T value()
      Value.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SemiExpiringStatistic

        public SemiExpiringStatistic​(org.terracotta.statistics.ValueStatistic<T> source,
                                     java.util.concurrent.ScheduledExecutorService executor,
                                     int historySize,
                                     long historyNanos)
        Creates a new semi-expiring statistic.
        Parameters:
        source - statistic source
        executor - executor to use for sampling
        historySize - size of sample history
        historyNanos - period between samples
    • Method Detail

      • history

        public java.util.List<org.terracotta.statistics.archive.Timestamped<T>> history()
        History.
        Specified by:
        history in interface ExtendedStatistics.Statistic<T extends java.lang.Number>
        Returns:
        the list
      • active

        public final boolean active()
        Description copied from interface: ExtendedStatistics.Statistic
        Active.
        Returns:
        true, if successful
      • touch

        protected final void touch()
        Touch.
      • start

        protected final void start()
        Start.
      • expire

        protected final boolean expire​(long expiry)
        Expire.
        Parameters:
        expiry - the expiry
        Returns:
        true, if successful
      • stopStatistic

        protected void stopStatistic()
        Stop statistic.
      • startStatistic

        protected void startStatistic()
        Start statistic.