Package com.google.api.gax.batching
Class NumericThreshold<E>
java.lang.Object
com.google.api.gax.batching.NumericThreshold<E>
- All Implemented Interfaces:
BatchingThreshold<E>
A threshold which accumulates a count based on the provided ElementCounter.
-
Constructor Summary
ConstructorsConstructorDescriptionNumericThreshold(long threshold, ElementCounter<E> extractor) Constructs a NumericThreshold. -
Method Summary
Modifier and TypeMethodDescriptionvoidaccumulate(E e) Presents the element to the threshold for the attribute of interest to be accumulated.Make a copy of this threshold but with the accumulated value zeroed.booleanAny calls into this function from ThresholdBatcher will be under a lock.
-
Constructor Details
-
NumericThreshold
Constructs a NumericThreshold.- Parameters:
threshold- The value that allows an event to happen.extractor- Object that extracts a numeric value from the value object.
-
-
Method Details
-
accumulate
Description copied from interface:BatchingThresholdPresents the element to the threshold for the attribute of interest to be accumulated.Any calls into this function from ThresholdBatcher will be under a lock.
- Specified by:
accumulatein interfaceBatchingThreshold<E>
-
isThresholdReached
public boolean isThresholdReached()Description copied from interface:BatchingThresholdAny calls into this function from ThresholdBatcher will be under a lock.- Specified by:
isThresholdReachedin interfaceBatchingThreshold<E>- Returns:
- whether the threshold has been reached.
-
copyWithZeroedValue
Description copied from interface:BatchingThresholdMake a copy of this threshold but with the accumulated value zeroed.Any calls into this function from ThresholdBatcher will be under a lock.
- Specified by:
copyWithZeroedValuein interfaceBatchingThreshold<E>
-