Class EventStatsMap<E>
- java.lang.Object
-
- org.pipecraft.infra.monitoring.collectors.EventStatsMap<E>
-
- Type Parameters:
E- The class representing all possible event categories
- Direct Known Subclasses:
EnumEventStatsMap,UnboundedEventStatsMap
public abstract class EventStatsMap<E> extends Object
A mapping between event categories and their respective counts. Not thread safe.- Author:
- Eyal Schneider
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedEventStatsMap(Map<E,Long> map)Constructor (protected)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(EventStatsMap<E> other)Adds the counts from the other collector.Map<E,Long>getCategoryStats()LonggetCount(E category)voidsetCategoryCounts(E category, long count)Sets the count for a specific category.net.minidev.json.JSONObjecttoJson()StringtoString()
-
-
-
Method Detail
-
getCount
public Long getCount(E category)
- Parameters:
category- A statistics category- Returns:
- the count in the given category
-
getCategoryStats
public Map<E,Long> getCategoryStats()
- Returns:
- the category statistics (read only)
-
setCategoryCounts
public void setCategoryCounts(E category, long count)
Sets the count for a specific category.- Parameters:
category- A stats categorycompleted- The number of events in the given category
-
toJson
public net.minidev.json.JSONObject toJson()
- Returns:
- The contents of this object, as json
-
add
public void add(EventStatsMap<E> other)
Adds the counts from the other collector. Not atomic.- Parameters:
other- The other collector to get the counters from
-
-