Class TimeLimiterImpl

java.lang.Object
io.github.resilience4j.timelimiter.internal.TimeLimiterImpl
All Implemented Interfaces:
TimeLimiter

public class TimeLimiterImpl extends Object implements TimeLimiter
  • Constructor Details

  • Method Details

    • decorateFutureSupplier

      public <T, F extends Future<T>> Callable<T> decorateFutureSupplier(Supplier<F> futureSupplier)
      Description copied from interface: TimeLimiter
      Creates a Callback that is restricted by a TimeLimiter.
      Specified by:
      decorateFutureSupplier in interface TimeLimiter
      Type Parameters:
      T - the type of results supplied by the supplier
      F - the future type supplied
      Parameters:
      futureSupplier - the original future supplier
      Returns:
      a future supplier which is restricted by a TimeLimiter.
    • decorateCompletionStage

      public <T, F extends CompletionStage<T>> Supplier<CompletionStage<T>> decorateCompletionStage(ScheduledExecutorService scheduler, Supplier<F> supplier)
      Description copied from interface: TimeLimiter
      Decorate a CompletionStage supplier which is decorated by a TimeLimiter
      Specified by:
      decorateCompletionStage in interface TimeLimiter
      Type Parameters:
      T - the type of the returned CompletionStage's result
      F - the CompletionStage type supplied
      Parameters:
      scheduler - execution service to use to schedule timeout
      supplier - the original CompletionStage supplier
      Returns:
      a CompletionStage supplier which is decorated by a TimeLimiter
    • getName

      public String getName()
      Specified by:
      getName in interface TimeLimiter
    • getTags

      public Map<String,String> getTags()
      Description copied from interface: TimeLimiter
      Returns an unmodifiable map with tags assigned to this TimeLimiter.
      Specified by:
      getTags in interface TimeLimiter
      Returns:
      the tags assigned to this TimeLimiter in an unmodifiable map
    • getTimeLimiterConfig

      public TimeLimiterConfig getTimeLimiterConfig()
      Description copied from interface: TimeLimiter
      Get the TimeLimiterConfig of this TimeLimiter decorator.
      Specified by:
      getTimeLimiterConfig in interface TimeLimiter
      Returns:
      the TimeLimiterConfig of this TimeLimiter decorator
    • getEventPublisher

      public TimeLimiter.EventPublisher getEventPublisher()
      Description copied from interface: TimeLimiter
      Returns an EventPublisher which can be used to register event consumers.
      Specified by:
      getEventPublisher in interface TimeLimiter
      Returns:
      an EventPublisher
    • onSuccess

      public void onSuccess()
      Description copied from interface: TimeLimiter
      Records a successful call.

      This method must be invoked when a call was successful.

      Specified by:
      onSuccess in interface TimeLimiter
    • onError

      public void onError(Throwable throwable)
      Description copied from interface: TimeLimiter
      Records a failed call. This method must be invoked when a call failed.
      Specified by:
      onError in interface TimeLimiter
      Parameters:
      throwable - The throwable which must be recorded