Class RateLimiterExecutor<R>

java.lang.Object
dev.failsafe.spi.PolicyExecutor<R>
dev.failsafe.internal.RateLimiterExecutor<R>
Type Parameters:
R - result type

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

  • Constructor Details

    • RateLimiterExecutor

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

    • preExecute

      protected ExecutionResult<R> preExecute()
      Description copied from class: PolicyExecutor
      Called before execution to return an alternative result or exception such as if execution is not allowed or needed.
      Overrides:
      preExecute in class PolicyExecutor<R>
    • preExecuteAsync

      protected 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>