public class ThresholdPolicyCount<T> extends Object implements ThresholdPolicy<T>
| Constructor and Description |
|---|
ThresholdPolicyCount(long threshold) |
| Modifier and Type | Method and Description |
|---|---|
long |
getCount()
Returns the current count of the number of items incremented in this policy.
|
long |
getThreshold()
Returns the threshold before the list is written to disk.
|
void |
increment(T item)
Call this method each time to increment the policy's threshold count.
|
boolean |
isThresholdExceeded()
Determines whether or not the configured threshold has been exceeded for this policy.
|
void |
reset()
Reset the policy back to the initial state.
|
String |
toString() |
public void increment(T item)
ThresholdPolicyincrement in interface ThresholdPolicy<T>item - The item that was added.public boolean isThresholdExceeded()
ThresholdPolicyisThresholdExceeded in interface ThresholdPolicy<T>true if the threshold has been reached; false otherwise.public void reset()
ThresholdPolicyreset in interface ThresholdPolicy<T>public long getThreshold()
public long getCount()
Licenced under the Apache License, Version 2.0