Class RateLimiterExecutor<R>

  • Type Parameters:
    R - result type

    public class RateLimiterExecutor<R>
    extends PolicyExecutor<R>
    A PolicyExecutor that handles failures according to a RateLimiter.
    • Field Detail

      • maxWaitTime

        private final java.time.Duration maxWaitTime
    • Constructor Detail

      • RateLimiterExecutor

        public RateLimiterExecutor​(RateLimiterImpl<R> rateLimiter,
                                   int policyIndex)
    • Method Detail

      • preExecuteAsync

        protected java.util.concurrent.CompletableFuture<ExecutionResult<R>> preExecuteAsync​(Scheduler scheduler,
                                                                                             FailsafeFuture<R> future)
        Description copied from class: PolicyExecutor
        Called before an async execution to return an alternative result or exception such as if execution is not allowed or needed. Returns null if pre execution is not performed. If the resulting future is completed with a non-result, then execution and post-execution should still be performed. If the resulting future is completed with null, then the execution is assumed to have been cancelled.
        Overrides:
        preExecuteAsync in class PolicyExecutor<R>