Class NonBlockingActionStatsCollector<E extends Enum<E>>

  • Type Parameters:
    E - The enum describing the different categories to be tracked
    All Implemented Interfaces:
    ActionStatsCollector<E>, JsonMonitorable

    public class NonBlockingActionStatsCollector<E extends Enum<E>>
    extends AbstractActionStatsCollector<E>
    A statistics collector which uses a non-blocking approach to improve performance. The getters don't guarantee data consistency, but they are accurate enough once enough data is gathered.
    Author:
    Eyal Schneider
    • Constructor Detail

      • NonBlockingActionStatsCollector

        public NonBlockingActionStatsCollector​(Class<E> categoriesEnumClass)
        Constructor
        Parameters:
        categoriesEnumClass - the enum describing the different categories to be tracked
    • Method Detail

      • innerEnd

        protected void innerEnd​(E category,
                                long duration)
        Description copied from class: AbstractActionStatsCollector
        The specific implementation of the "end" operation
        Specified by:
        innerEnd in class AbstractActionStatsCollector<E extends Enum<E>>
        Parameters:
        category - The action category
        duration - The measured action duration, in micros
      • startAndEnd

        public void startAndEnd​(E category)
        Description copied from interface: ActionStatsCollector
        Indicates the starting and termination of an "instant" action (duration = 0)
        Parameters:
        category - The category to place the action stats into
      • getRunning

        public int getRunning()
        Returns:
        The number of actions currently in execution
      • getCompletedCount

        public long getCompletedCount​(E category)
        Parameters:
        category - A stats category
        Returns:
        The number of actions of the given category that has been completed so far
      • getTotalDurationMicros

        public long getTotalDurationMicros​(E category)
        Parameters:
        category - A stats category
        Returns:
        The total duration of completed actions in the given category
      • getAll

        public ActionStatsMap<E> getAll()
        Returns:
        A snapshot of all statistics. The data consistency guarantees depend on the specific implementation.
      • clear

        public void clear()
        Description copied from interface: ActionStatsCollector
        Clears all statistics. The atomicity of this operation depends on the specific implementation.