Package org.terracotta.statistics
Class StatisticMapper<SOURCE extends Enum<SOURCE>,TARGET extends Enum<TARGET>>
java.lang.Object
org.terracotta.statistics.StatisticMapper<SOURCE,TARGET>
- All Implemented Interfaces:
OperationObserver<TARGET>,OperationStatistic<TARGET>,SourceStatistic<ChainedOperationObserver<? super TARGET>>
public class StatisticMapper<SOURCE extends Enum<SOURCE>,TARGET extends Enum<TARGET>>
extends Object
implements OperationStatistic<TARGET>
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final ConcurrentMap<ChainedOperationObserver<? super TARGET>,ChainedOperationObserver<SOURCE>> private final OperationStatistic<SOURCE> -
Constructor Summary
ConstructorsConstructorDescriptionStatisticMapper(Map<TARGET, Set<SOURCE>> translation, OperationStatistic<SOURCE> statistic) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddDerivedStatistic(ChainedOperationObserver<? super TARGET> derived) Register the givenObserverto be called by thisSourceStatisticvoidbegin()Called immediately prior to the operation beginning.longReturn the count of operations with the given type.voidCalled immediately after the operation completes with no interesting parameters, and with the same thread the called {OperationObserver.begin()} before.Collection<ChainedOperationObserver<? super TARGET>>Retrieve all registered statistics.voidremoveDerivedStatistic(ChainedOperationObserver<? super TARGET> derived) Remove the given registeredObserverfrom thisSourceStatistic.Return aValueStatisticreturning the count for the given result.longsum()longtype()
-
Field Details
-
targetType
-
sourceType
-
statistic
-
translation
-
reverseTranslation
-
derivedStats
private final ConcurrentMap<ChainedOperationObserver<? super TARGET extends Enum<TARGET>>,ChainedOperationObserver<SOURCE extends Enum<SOURCE>>> derivedStats
-
-
Constructor Details
-
StatisticMapper
-
-
Method Details
-
reverse
-
type
- Specified by:
typein interfaceOperationStatistic<SOURCE extends Enum<SOURCE>>
-
statistic
Description copied from interface:OperationStatisticReturn aValueStatisticreturning the count for the given result.- Specified by:
statisticin interfaceOperationStatistic<SOURCE extends Enum<SOURCE>>- Parameters:
result- the result of interest- Returns:
- a
ValueStatisticinstance
-
statistic
- Specified by:
statisticin interfaceOperationStatistic<SOURCE extends Enum<SOURCE>>
-
count
Description copied from interface:OperationStatisticReturn the count of operations with the given type.- Specified by:
countin interfaceOperationStatistic<SOURCE extends Enum<SOURCE>>- Parameters:
type- the result type- Returns:
- the operation count
-
sum
- Specified by:
sumin interfaceOperationStatistic<SOURCE extends Enum<SOURCE>>
-
sum
public long sum()- Specified by:
sumin interfaceOperationStatistic<SOURCE extends Enum<SOURCE>>
-
addDerivedStatistic
Description copied from interface:SourceStatisticRegister the givenObserverto be called by thisSourceStatistic- Specified by:
addDerivedStatisticin interfaceSourceStatistic<SOURCE extends Enum<SOURCE>>- Parameters:
derived- statistic to be registered
-
removeDerivedStatistic
Description copied from interface:SourceStatisticRemove the given registeredObserverfrom thisSourceStatistic.- Specified by:
removeDerivedStatisticin interfaceSourceStatistic<SOURCE extends Enum<SOURCE>>- Parameters:
derived- statistic to be removed
-
getDerivedStatistics
Description copied from interface:SourceStatisticRetrieve all registered statistics.- Specified by:
getDerivedStatisticsin interfaceSourceStatistic<SOURCE extends Enum<SOURCE>>- 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<SOURCE extends Enum<SOURCE>>
-
end
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<SOURCE extends Enum<SOURCE>>- Parameters:
result- the operation result
-