Class TimeLimiterImpl
java.lang.Object
io.github.resilience4j.timelimiter.internal.TimeLimiterImpl
- All Implemented Interfaces:
TimeLimiter
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.github.resilience4j.timelimiter.TimeLimiter
TimeLimiter.EventPublisher
-
Field Summary
Fields inherited from interface io.github.resilience4j.timelimiter.TimeLimiter
DEFAULT_NAME
-
Constructor Summary
ConstructorsConstructorDescriptionTimeLimiterImpl
(String name, TimeLimiterConfig timeLimiterConfig) TimeLimiterImpl
(String name, TimeLimiterConfig timeLimiterConfig, Map<String, String> tags) -
Method Summary
Modifier and TypeMethodDescription<T,
F extends CompletionStage<T>>
Supplier<CompletionStage<T>>decorateCompletionStage
(ScheduledExecutorService scheduler, Supplier<F> supplier) Decorate a CompletionStage supplier which is decorated by a TimeLimiterdecorateFutureSupplier
(Supplier<F> futureSupplier) Creates a Callback that is restricted by a TimeLimiter.Returns an EventPublisher which can be used to register event consumers.getName()
getTags()
Returns an unmodifiable map with tags assigned to this TimeLimiter.Get the TimeLimiterConfig of this TimeLimiter decorator.void
Records a failed call.void
Records a successful call.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.github.resilience4j.timelimiter.TimeLimiter
executeCompletionStage, executeFutureSupplier
-
Constructor Details
-
TimeLimiterImpl
-
TimeLimiterImpl
-
-
Method Details
-
decorateFutureSupplier
Description copied from interface:TimeLimiter
Creates a Callback that is restricted by a TimeLimiter.- Specified by:
decorateFutureSupplier
in interfaceTimeLimiter
- Type Parameters:
T
- the type of results supplied by the supplierF
- 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 interfaceTimeLimiter
- Type Parameters:
T
- the type of the returned CompletionStage's resultF
- the CompletionStage type supplied- Parameters:
scheduler
- execution service to use to schedule timeoutsupplier
- the original CompletionStage supplier- Returns:
- a CompletionStage supplier which is decorated by a TimeLimiter
-
getName
- Specified by:
getName
in interfaceTimeLimiter
-
getTags
Description copied from interface:TimeLimiter
Returns an unmodifiable map with tags assigned to this TimeLimiter.- Specified by:
getTags
in interfaceTimeLimiter
- Returns:
- the tags assigned to this TimeLimiter in an unmodifiable map
-
getTimeLimiterConfig
Description copied from interface:TimeLimiter
Get the TimeLimiterConfig of this TimeLimiter decorator.- Specified by:
getTimeLimiterConfig
in interfaceTimeLimiter
- Returns:
- the TimeLimiterConfig of this TimeLimiter decorator
-
getEventPublisher
Description copied from interface:TimeLimiter
Returns an EventPublisher which can be used to register event consumers.- Specified by:
getEventPublisher
in interfaceTimeLimiter
- 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 interfaceTimeLimiter
-
onError
Description copied from interface:TimeLimiter
Records a failed call. This method must be invoked when a call failed.- Specified by:
onError
in interfaceTimeLimiter
- Parameters:
throwable
- The throwable which must be recorded
-