public class RateLimiterBuilder extends Object
| Modifier and Type | Method and Description |
|---|---|
RateLimiter |
build()
Build and obtain a configured rate limiter.
|
static RateLimiterBuilder |
newBuilder()
Obtain a new builder instance.
|
RateLimiterBuilder |
withConstantThroughput()
Configure the rate limiter to use a constant throughput strategy for rate limiting.
|
RateLimiterBuilder |
withRate(int invocations,
TimeUnit perTimeUnit)
Set the maximum rate that the limiter should allow, expressed as the number of invocations
allowed in a given time period.
|
public static RateLimiterBuilder newBuilder()
public RateLimiterBuilder withRate(int invocations, TimeUnit perTimeUnit)
invocations - number of invocationsperTimeUnit - the time period in which this number of invocations are allowedpublic RateLimiterBuilder withConstantThroughput()
public RateLimiter build()
Copyright © 2019. All rights reserved.