@BetaApi(value="The surface for batching is not stable yet and may change in the future.") public final class NumericThreshold<E> extends Object implements BatchingThreshold<E>
| Constructor and Description |
|---|
NumericThreshold(long threshold,
ElementCounter<E> extractor)
Constructs a NumericThreshold.
|
| Modifier and Type | Method and 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.
|
public NumericThreshold(long threshold,
ElementCounter<E> extractor)
threshold - The value that allows an event to happen.extractor - Object that extracts a numeric value from the value object.public void accumulate(E e)
BatchingThresholdAny calls into this function from ThresholdBatcher will be under a lock.
accumulate in interface BatchingThreshold<E>public boolean isThresholdReached()
BatchingThresholdisThresholdReached in interface BatchingThreshold<E>public BatchingThreshold<E> copyWithZeroedValue()
BatchingThresholdAny calls into this function from ThresholdBatcher will be under a lock.
copyWithZeroedValue in interface BatchingThreshold<E>