Package org.terracotta.statistics
Class MappedOperationStatistic<S extends java.lang.Enum<S>,D extends java.lang.Enum<D>>
- java.lang.Object
-
- org.terracotta.statistics.MappedOperationStatistic<S,D>
-
- All Implemented Interfaces:
OperationObserver<D>,OperationStatistic<D>,SourceStatistic<ChainedOperationObserver<? super D>>
public class MappedOperationStatistic<S extends java.lang.Enum<S>,D extends java.lang.Enum<D>> extends java.lang.Object implements OperationStatistic<D>
-
-
Field Summary
Fields Modifier and Type Field Description private StatisticMapper<S,D>mapperjava.lang.Stringnamejava.lang.Class<D>outcomeTypejava.util.Map<java.lang.String,java.lang.Object>propertiesjava.util.Set<java.lang.String>tags
-
Constructor Summary
Constructors Constructor Description MappedOperationStatistic(java.lang.Object tier, java.util.Map<D,java.util.Set<S>> translation, java.lang.String statisticName, int tierHeight, java.lang.String targetName, java.lang.String discriminator)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddDerivedStatistic(ChainedOperationObserver<? super D> derived)Register the givenObserverto be called by thisSourceStatisticvoidbegin()Called immediately prior to the operation beginning.longcount(D type)Return the count of operations with the given type.voidend(D result)Called immediately after the operation completes with no interesting parameters, and with the same thread the called {OperationObserver.begin()} before.private static <S extends java.lang.Enum<S>>
OperationStatistic<S>findOperationStat(java.lang.Object rootNode, java.lang.Class<S> statisticType, java.lang.String statName)java.util.Collection<ChainedOperationObserver<? super D>>getDerivedStatistics()Retrieve all registered statistics.voidremoveDerivedStatistic(ChainedOperationObserver<? super D> derived)Remove the given registeredObserverfrom thisSourceStatistic.ValueStatistic<java.lang.Long>statistic(D result)Return aValueStatisticreturning the count for the given result.ValueStatistic<java.lang.Long>statistic(java.util.Set<D> results)longsum()longsum(java.util.Set<D> types)java.lang.Class<D>type()
-
-
-
Field Detail
-
name
public final java.lang.String name
-
tags
public final java.util.Set<java.lang.String> tags
-
properties
public final java.util.Map<java.lang.String,java.lang.Object> properties
-
mapper
private final StatisticMapper<S extends java.lang.Enum<S>,D extends java.lang.Enum<D>> mapper
-
-
Method Detail
-
type
public java.lang.Class<D> type()
- Specified by:
typein interfaceOperationStatistic<S extends java.lang.Enum<S>>
-
statistic
public ValueStatistic<java.lang.Long> statistic(D result)
Description copied from interface:OperationStatisticReturn aValueStatisticreturning the count for the given result.- Specified by:
statisticin interfaceOperationStatistic<S extends java.lang.Enum<S>>- Parameters:
result- the result of interest- Returns:
- a
ValueStatisticinstance
-
statistic
public ValueStatistic<java.lang.Long> statistic(java.util.Set<D> results)
- Specified by:
statisticin interfaceOperationStatistic<S extends java.lang.Enum<S>>
-
count
public long count(D type)
Description copied from interface:OperationStatisticReturn the count of operations with the given type.- Specified by:
countin interfaceOperationStatistic<S extends java.lang.Enum<S>>- Parameters:
type- the result type- Returns:
- the operation count
-
sum
public long sum(java.util.Set<D> types)
- Specified by:
sumin interfaceOperationStatistic<S extends java.lang.Enum<S>>
-
sum
public long sum()
- Specified by:
sumin interfaceOperationStatistic<S extends java.lang.Enum<S>>
-
addDerivedStatistic
public void addDerivedStatistic(ChainedOperationObserver<? super D> derived)
Description copied from interface:SourceStatisticRegister the givenObserverto be called by thisSourceStatistic- Specified by:
addDerivedStatisticin interfaceSourceStatistic<S extends java.lang.Enum<S>>- Parameters:
derived- statistic to be registered
-
removeDerivedStatistic
public void removeDerivedStatistic(ChainedOperationObserver<? super D> derived)
Description copied from interface:SourceStatisticRemove the given registeredObserverfrom thisSourceStatistic.- Specified by:
removeDerivedStatisticin interfaceSourceStatistic<S extends java.lang.Enum<S>>- Parameters:
derived- statistic to be removed
-
getDerivedStatistics
public java.util.Collection<ChainedOperationObserver<? super D>> getDerivedStatistics()
Description copied from interface:SourceStatisticRetrieve all registered statistics.- Specified by:
getDerivedStatisticsin interfaceSourceStatistic<S extends java.lang.Enum<S>>- Returns:
- an unmodifiable collection of all derived statistics
-
begin
public void begin()
Description copied from interface:OperationObserverCalled immediately prior to the operation beginning.- Specified by:
beginin interfaceOperationObserver<S extends java.lang.Enum<S>>
-
end
public void end(D result)
Description copied from interface:OperationObserverCalled immediately after the operation completes with no interesting parameters, and with the same thread the called {OperationObserver.begin()} before.- Specified by:
endin interfaceOperationObserver<S extends java.lang.Enum<S>>- Parameters:
result- the operation result
-
findOperationStat
private static <S extends java.lang.Enum<S>> OperationStatistic<S> findOperationStat(java.lang.Object rootNode, java.lang.Class<S> statisticType, java.lang.String statName)
-
-