Class BlockingActionStatsCollector<E extends Enum<E>>
- java.lang.Object
-
- org.pipecraft.infra.monitoring.collectors.AbstractActionStatsCollector<E>
-
- org.pipecraft.infra.monitoring.collectors.BlockingActionStatsCollector<E>
-
- Type Parameters:
E- The enum describing the different categories to be tracked
- All Implemented Interfaces:
ActionStatsCollector<E>,JsonMonitorable
public class BlockingActionStatsCollector<E extends Enum<E>> extends AbstractActionStatsCollector<E>
A statistics collector which uses synchronization locks for guaranteeing data consistency.- Author:
- Eyal Schneider
-
-
Field Summary
-
Fields inherited from class org.pipecraft.infra.monitoring.collectors.AbstractActionStatsCollector
categoriesEnumClass
-
-
Constructor Summary
Constructors Constructor Description BlockingActionStatsCollector(Class<E> categoriesEnumClass)Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()Clears all statistics.ActionStatsMap<E>getAll()longgetCompletedCount(E category)intgetRunning()longgetTotalDurationMicros(E category)protected voidinnerEnd(E category, long duration)The specific implementation of the "end" operationprotected voidinnerStart()The specific implementation of the "start" operationvoidstartAndEnd(E category)Indicates the starting and termination of an "instant" action (duration = 0)-
Methods inherited from class org.pipecraft.infra.monitoring.collectors.AbstractActionStatsCollector
duration, end, end, getChildren, getOwnMetrics, start
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.pipecraft.infra.monitoring.JsonMonitorable
getFullMetrics
-
-
-
-
Method Detail
-
innerStart
protected void innerStart()
Description copied from class:AbstractActionStatsCollectorThe specific implementation of the "start" operation- Specified by:
innerStartin classAbstractActionStatsCollector<E extends Enum<E>>
-
innerEnd
protected void innerEnd(E category, long duration)
Description copied from class:AbstractActionStatsCollectorThe specific implementation of the "end" operation- Specified by:
innerEndin classAbstractActionStatsCollector<E extends Enum<E>>- Parameters:
category- The action categoryduration- The measured action duration, in micros
-
startAndEnd
public void startAndEnd(E category)
Description copied from interface:ActionStatsCollectorIndicates 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:ActionStatsCollectorClears all statistics. The atomicity of this operation depends on the specific implementation.
-
-