Package org.terracotta.statistics
Class ZeroOperationStatistic<T extends Enum<T>>
- java.lang.Object
-
- org.terracotta.statistics.ZeroOperationStatistic<T>
-
- All Implemented Interfaces:
OperationObserver<T>,OperationStatistic<T>,SourceStatistic<ChainedOperationObserver<? super T>>
public class ZeroOperationStatistic<T extends Enum<T>> extends Object implements OperationStatistic<T>
An operation statistic that always return 0 for everything. Used as a null object.
-
-
Constructor Summary
Constructors Constructor Description ZeroOperationStatistic()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddDerivedStatistic(ChainedOperationObserver<? super T> derived)Register the givenObserverto be called by thisSourceStatisticvoidbegin()Called immediately prior to the operation beginning.longcount(T type)Return the count of operations with the given type.voidend(T result)Called immediately after the operation completes with no interesting parameters, and with the same thread the called {OperationObserver.begin()} before.static <T extends Enum<T>>
OperationStatistic<T>get()Collection<ChainedOperationObserver<? super T>>getDerivedStatistics()Retrieve all registered statistics.voidremoveDerivedStatistic(ChainedOperationObserver<? super T> derived)Remove the given registeredObserverfrom thisSourceStatistic.longsum()longsum(Set<T> types)Class<T>type()-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.terracotta.statistics.OperationStatistic
statistic, statistic
-
-
-
-
Method Detail
-
get
public static <T extends Enum<T>> OperationStatistic<T> get()
-
count
public long count(T type)
Description copied from interface:OperationStatisticReturn the count of operations with the given type.- Specified by:
countin interfaceOperationStatistic<T extends Enum<T>>- Parameters:
type- the result type- Returns:
- the operation count
-
sum
public long sum(Set<T> types)
- Specified by:
sumin interfaceOperationStatistic<T extends Enum<T>>
-
sum
public long sum()
- Specified by:
sumin interfaceOperationStatistic<T extends Enum<T>>
-
addDerivedStatistic
public void addDerivedStatistic(ChainedOperationObserver<? super T> derived)
Description copied from interface:SourceStatisticRegister the givenObserverto be called by thisSourceStatistic- Specified by:
addDerivedStatisticin interfaceSourceStatistic<T extends Enum<T>>- Parameters:
derived- statistic to be registered
-
removeDerivedStatistic
public void removeDerivedStatistic(ChainedOperationObserver<? super T> derived)
Description copied from interface:SourceStatisticRemove the given registeredObserverfrom thisSourceStatistic.- Specified by:
removeDerivedStatisticin interfaceSourceStatistic<T extends Enum<T>>- Parameters:
derived- statistic to be removed
-
getDerivedStatistics
public Collection<ChainedOperationObserver<? super T>> getDerivedStatistics()
Description copied from interface:SourceStatisticRetrieve all registered statistics.- Specified by:
getDerivedStatisticsin interfaceSourceStatistic<T extends Enum<T>>- 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<T extends Enum<T>>
-
end
public void end(T 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<T extends Enum<T>>- Parameters:
result- the operation result
-
-