Package com.google.api.gax.batching
Interface BatchingThreshold<E>
-
- All Known Implementing Classes:
NumericThreshold
public interface BatchingThreshold<E>
The interface representing a threshold to be used in ThresholdBatcher. Thresholds do not need to be thread-safe if they are only used inside ThresholdBatcher.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
accumulate(E e)
Presents the element to the threshold for the attribute of interest to be accumulated.BatchingThreshold<E>
copyWithZeroedValue()
Make a copy of this threshold but with the accumulated value zeroed.boolean
isThresholdReached()
Any calls into this function from ThresholdBatcher will be under a lock.
-
-
-
Method Detail
-
accumulate
void accumulate(E e)
Presents 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.
-
isThresholdReached
boolean isThresholdReached()
Any calls into this function from ThresholdBatcher will be under a lock.- Returns:
- whether the threshold has been reached.
-
copyWithZeroedValue
BatchingThreshold<E> copyWithZeroedValue()
Make a copy of this threshold but with the accumulated value zeroed.Any calls into this function from ThresholdBatcher will be under a lock.
-
-