Package org.apache.pulsar.broker.qos
Class DynamicRateAsyncTokenBucket
java.lang.Object
org.apache.pulsar.broker.qos.AsyncTokenBucket
org.apache.pulsar.broker.qos.DynamicRateAsyncTokenBucket
A subclass of
AsyncTokenBucket that represents a token bucket with a dynamic rate.
The rate and capacity of the token bucket can change over time based on the rate function and capacity factor.-
Field Summary
Fields inherited from class org.apache.pulsar.broker.qos.AsyncTokenBucket
DEFAULT_SNAPSHOT_CLOCK, resolutionNanos, tokens -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedDynamicRateAsyncTokenBucket(double capacityFactor, LongSupplier rateFunction, MonotonicSnapshotClock clockSource, LongSupplier ratePeriodNanosFunction, long resolutionNanos, double initialTokensFactor, double targetFillFactorAfterThrottling) -
Method Summary
Methods inherited from class org.apache.pulsar.broker.qos.AsyncTokenBucket
builder, builderForDynamicRate, calculateThrottlingDuration, consumeTokens, consumeTokensAndCheckIfContainsTokens, containsTokens, containsTokens, getTokens, resetToDefaultEventualConsistentTokensView, switchToConsistentTokensView, tokens
-
Constructor Details
-
DynamicRateAsyncTokenBucket
protected DynamicRateAsyncTokenBucket(double capacityFactor, LongSupplier rateFunction, MonotonicSnapshotClock clockSource, LongSupplier ratePeriodNanosFunction, long resolutionNanos, double initialTokensFactor, double targetFillFactorAfterThrottling)
-
-
Method Details
-
getRatePeriodNanos
protected long getRatePeriodNanos()- Specified by:
getRatePeriodNanosin classAsyncTokenBucket
-
getTargetAmountOfTokensAfterThrottling
protected long getTargetAmountOfTokensAfterThrottling()- Specified by:
getTargetAmountOfTokensAfterThrottlingin classAsyncTokenBucket
-
getCapacity
public long getCapacity()- Specified by:
getCapacityin classAsyncTokenBucket
-
getRate
public long getRate()- Specified by:
getRatein classAsyncTokenBucket
-