Class TimeLimiterMethodInterceptor
java.lang.Object
io.github.resilience4j.ratpack.internal.AbstractMethodInterceptor
io.github.resilience4j.ratpack.timelimiter.TimeLimiterMethodInterceptor
- All Implemented Interfaces:
org.aopalliance.aop.Advice,org.aopalliance.intercept.Interceptor,org.aopalliance.intercept.MethodInterceptor
public class TimeLimiterMethodInterceptor extends AbstractMethodInterceptor
A
MethodInterceptor to handle all methods annotated with TimeLimiter. It will
handle methods that return a Promise, Flux, Mono, CompletionStage, or value.
Given a method like this:
@TimeLimiter(name = "myService")
public String fancyName(String name) {
return "Sir Captain " + name;
}
each time the #fancyName(String) method is invoked, the method's execution will pass
through a a TimeLimiter according to the given
config.
The fallbackMethod signature must match either:
1) The method parameter signature on the annotated method or 2) The method parameter signature with a matching exception type as the last parameter on the annotated method
The return value can be a Promise, CompletionStage, Flux, Mono, or an object value. Other
reactive types are not supported.
If the return value is one of the reactive types listed above, it must match the return value type of the annotated method.
-
Constructor Summary
Constructors Constructor Description TimeLimiterMethodInterceptor() -
Method Summary
Modifier and Type Method Description java.lang.Objectinvoke(org.aopalliance.intercept.MethodInvocation invocation)java.lang.ObjectinvokeForCompletionStage(org.aopalliance.intercept.MethodInvocation invocation, RecoveryFunction<?> fallbackMethod, io.github.resilience4j.timelimiter.TimeLimiter timeLimiter)java.lang.ObjectinvokeForFlux(org.aopalliance.intercept.MethodInvocation invocation, RecoveryFunction<?> fallbackMethod, io.github.resilience4j.timelimiter.TimeLimiter timeLimiter)java.lang.ObjectinvokeForMono(org.aopalliance.intercept.MethodInvocation invocation, RecoveryFunction<?> fallbackMethod, io.github.resilience4j.timelimiter.TimeLimiter timeLimiter)java.lang.ObjectinvokeForPromise(org.aopalliance.intercept.MethodInvocation invocation, RecoveryFunction<?> fallbackMethod, io.github.resilience4j.timelimiter.TimeLimiter timeLimiter)Methods inherited from class io.github.resilience4j.ratpack.internal.AbstractMethodInterceptor
completeFailedFuture, createRecoveryFunction, proceed
-
Constructor Details
-
TimeLimiterMethodInterceptor
public TimeLimiterMethodInterceptor()
-
-
Method Details
-
invoke
@Nullable public java.lang.Object invoke(org.aopalliance.intercept.MethodInvocation invocation) throws java.lang.Throwable- Throws:
java.lang.Throwable
-
invokeForPromise
public java.lang.Object invokeForPromise(org.aopalliance.intercept.MethodInvocation invocation, RecoveryFunction<?> fallbackMethod, io.github.resilience4j.timelimiter.TimeLimiter timeLimiter) throws java.lang.Throwable- Throws:
java.lang.Throwable
-
invokeForFlux
public java.lang.Object invokeForFlux(org.aopalliance.intercept.MethodInvocation invocation, RecoveryFunction<?> fallbackMethod, io.github.resilience4j.timelimiter.TimeLimiter timeLimiter) throws java.lang.Throwable- Throws:
java.lang.Throwable
-
invokeForMono
public java.lang.Object invokeForMono(org.aopalliance.intercept.MethodInvocation invocation, RecoveryFunction<?> fallbackMethod, io.github.resilience4j.timelimiter.TimeLimiter timeLimiter) throws java.lang.Throwable- Throws:
java.lang.Throwable
-
invokeForCompletionStage
public java.lang.Object invokeForCompletionStage(org.aopalliance.intercept.MethodInvocation invocation, RecoveryFunction<?> fallbackMethod, io.github.resilience4j.timelimiter.TimeLimiter timeLimiter)
-