Package org.terracotta.statistics
Class ZeroOperationStatistic<T extends java.lang.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 java.lang.Enum<T>> extends java.lang.Object implements OperationStatistic<T>
An operation statistic that always return 0 for everything. Used as a null object.
-
-
Field Summary
Fields Modifier and Type Field Description private static OperationStatistic<?>INSTANCE
-
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 java.lang.Enum<T>>
OperationStatistic<T>get()java.util.Collection<ChainedOperationObserver<? super T>>getDerivedStatistics()Retrieve all registered statistics.voidremoveDerivedStatistic(ChainedOperationObserver<? super T> derived)Remove the given registeredObserverfrom thisSourceStatistic.longsum()longsum(java.util.Set<T> types)java.lang.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
-
-
-
-
Field Detail
-
INSTANCE
private static final OperationStatistic<?> INSTANCE
-
-
Method Detail
-
get
public static <T extends java.lang.Enum<T>> OperationStatistic<T> get()
-
type
public java.lang.Class<T> type()
- Specified by:
typein interfaceOperationStatistic<T extends java.lang.Enum<T>>
-
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 java.lang.Enum<T>>- Parameters:
type- the result type- Returns:
- the operation count
-
sum
public long sum(java.util.Set<T> types)
- Specified by:
sumin interfaceOperationStatistic<T extends java.lang.Enum<T>>
-
sum
public long sum()
- Specified by:
sumin interfaceOperationStatistic<T extends java.lang.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 java.lang.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 java.lang.Enum<T>>- Parameters:
derived- statistic to be removed
-
getDerivedStatistics
public java.util.Collection<ChainedOperationObserver<? super T>> getDerivedStatistics()
Description copied from interface:SourceStatisticRetrieve all registered statistics.- Specified by:
getDerivedStatisticsin interfaceSourceStatistic<T extends java.lang.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 java.lang.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 java.lang.Enum<T>>- Parameters:
result- the operation result
-
-