Class TimeLimiterTransformer<T>
java.lang.Object
io.github.resilience4j.ratpack.internal.AbstractTransformer<T>
io.github.resilience4j.ratpack.timelimiter.TimeLimiterTransformer<T>
- All Implemented Interfaces:
ratpack.func.Function<ratpack.exec.Upstream<? extends T>,ratpack.exec.Upstream<T>>
public class TimeLimiterTransformer<T> extends AbstractTransformer<T>
-
Nested Class Summary
-
Field Summary
-
Method Summary
Modifier and Type Method Description ratpack.exec.Upstream<T>apply(ratpack.exec.Upstream<? extends T> upstream)static <T> TimeLimiterTransformer<T>of(io.github.resilience4j.timelimiter.TimeLimiter timeLimiter)Create a new transformer that can be applied to thePromise.transform(Function)method.voidonException(ratpack.exec.Downstream<? super T> downstream, java.lang.Throwable throwable)voidonPromiseResult(java.util.concurrent.atomic.AtomicBoolean done, ratpack.exec.Downstream<? super T> innerDownstream, java.util.concurrent.ScheduledFuture<?> timeoutFuture, ratpack.exec.ExecResult<? extends T> execResult)voidonTimedPromiseResult(ratpack.exec.Downstream<? super T> downstream, ratpack.exec.ExecResult<? extends T> execResult)TimeLimiterTransformer<T>recover(ratpack.func.Function<java.lang.Throwable,? extends T> recoverer)Set a recovery function that will execute when the timeLimiter timeout is exceeded.voidscheduleTimeout(java.util.concurrent.atomic.AtomicBoolean done, ratpack.exec.Downstream<? super T> innerDownstream)Methods inherited from class io.github.resilience4j.ratpack.internal.AbstractTransformer
handleRecovery
-
Method Details
-
of
public static <T> TimeLimiterTransformer<T> of(io.github.resilience4j.timelimiter.TimeLimiter timeLimiter)Create a new transformer that can be applied to thePromise.transform(Function)method. The Promised value will pass through the timeLimiter, potentially causing it to time out.- Type Parameters:
T- the type of object- Parameters:
timeLimiter- the timeLimiter to use- Returns:
- the transformer
-
recover
public TimeLimiterTransformer<T> recover(ratpack.func.Function<java.lang.Throwable,? extends T> recoverer)Set a recovery function that will execute when the timeLimiter timeout is exceeded.- Parameters:
recoverer- the recovery function- Returns:
- the transformer
-
apply
public ratpack.exec.Upstream<T> apply(ratpack.exec.Upstream<? extends T> upstream) throws java.lang.Exception- Throws:
java.lang.Exception
-
scheduleTimeout
public void scheduleTimeout(java.util.concurrent.atomic.AtomicBoolean done, ratpack.exec.Downstream<? super T> innerDownstream) -
onPromiseResult
-
onTimedPromiseResult
-
onException
public void onException(ratpack.exec.Downstream<? super T> downstream, java.lang.Throwable throwable)
-