R - result typepublic class RateLimiterBuilder<R> extends PolicyBuilder<RateLimiterBuilder<R>,RateLimiterConfig<R>,R>
RateLimiter instances.
This class is not threadsafe.
RateLimiterConfig,
RateLimitExceededExceptionconfig| Modifier and Type | Method and Description |
|---|---|
RateLimiter<R> |
build()
Builds a new
RateLimiter using the builder's configuration. |
RateLimiterBuilder<R> |
withMaxWaitTime(Duration maxWaitTime)
Configures the
maxWaitTime to wait for permits to be available. |
onFailure, onSuccesspublic RateLimiter<R> build()
RateLimiter using the builder's configuration.public RateLimiterBuilder<R> withMaxWaitTime(Duration maxWaitTime)
maxWaitTime to wait for permits to be available. If permits cannot be acquired before the
maxWaitTime is exceeded, then the rate limiter will throw RateLimitExceededException.
This setting only applies when the resulting RateLimiter is used with the Failsafe class. It does not apply
when the RateLimiter is used in a standalone way.
NullPointerException - if maxWaitTime is nullCopyright © 2022. All rights reserved.