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.voidRecords a failed call.voidRecords a successful call.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.github.resilience4j.timelimiter.TimeLimiter
executeCompletionStage, executeFutureSupplier
-
Constructor Details
-
TimeLimiterImpl
-
TimeLimiterImpl
-
-
Method Details
-
decorateFutureSupplier
Description copied from interface:TimeLimiterCreates a Callback that is restricted by a TimeLimiter.- Specified by:
decorateFutureSupplierin 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:TimeLimiterDecorate a CompletionStage supplier which is decorated by a TimeLimiter- Specified by:
decorateCompletionStagein 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:
getNamein interfaceTimeLimiter
-
getTags
Description copied from interface:TimeLimiterReturns an unmodifiable map with tags assigned to this TimeLimiter.- Specified by:
getTagsin interfaceTimeLimiter- Returns:
- the tags assigned to this TimeLimiter in an unmodifiable map
-
getTimeLimiterConfig
Description copied from interface:TimeLimiterGet the TimeLimiterConfig of this TimeLimiter decorator.- Specified by:
getTimeLimiterConfigin interfaceTimeLimiter- Returns:
- the TimeLimiterConfig of this TimeLimiter decorator
-
getEventPublisher
Description copied from interface:TimeLimiterReturns an EventPublisher which can be used to register event consumers.- Specified by:
getEventPublisherin interfaceTimeLimiter- Returns:
- an EventPublisher
-
onSuccess
public void onSuccess()Description copied from interface:TimeLimiterRecords a successful call.This method must be invoked when a call was successful.
- Specified by:
onSuccessin interfaceTimeLimiter
-
onError
Description copied from interface:TimeLimiterRecords a failed call. This method must be invoked when a call failed.- Specified by:
onErrorin interfaceTimeLimiter- Parameters:
throwable- The throwable which must be recorded
-