Uploaded image for project: 'Geode'
  1. Geode
  2. GEODE-7010

Replace static globals in CachePerfStats with StatisticsClock

    XMLWordPrintableJSON

Details

    • Wish
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 1.10.0
    • statistics
    • None

    Description

      Introduce new StatisticsClock interface. An instance will be created during Cache creation. The method isEnabled() will be configured by system.getConfig().getEnableTimeStatistics() and getTime() will return System.nanoTime() if enabled or zero if disabled. This instance will be passed around and injected as a dependency via the constructor of each class that uses it.

      @FunctionalInterface
      public interface StatisticsClock {
      
        /**
         * Returns the current value of the running Java Virtual Machine's high-resolution time source,
         * in nanoseconds.
         *
         * <p>
         * See {@code java.lang.System#nanoTime()}.
         */
        long getTime();
      
        /**
         * Returns true if this clock is enabled. If disabled then {@code getTime()} will return zero.
         *
         * <p>
         * Default returns {@code true}.
         */
        default boolean isEnabled() {
          return true;
        }
      }
      

      Attachments

        Activity

          People

            klund Kirk Lund
            klund Kirk Lund
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 2h 50m
                2h 50m