You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: resilience4j-spring/src/main/java/io/github/resilience4j/circuitbreaker/configure/CircuitBreakerAspect.java
* Reflection utility for invoking a fallback method. A fallback method should have the same return type and parameter types of original method but the last additional parameter.
31
-
* The last additional parameter should be a subclass of {@link Throwable}. When {@link FallbackMethod#recover(Throwable)} is invoked, {@link Throwable} will be passed to that last parameter.
32
-
* If there are multiple fallback methods, one of the methods that has most closest superclass parameter of thrown object will be invoked.
31
+
* Reflection utility for invoking a fallback method. Fallback method should have same return type and parameter types of original method but the last additional parameter.
32
+
* The last additional parameter should be a subclass of {@link Throwable}. When {@link FallbackMethod#fallback(Throwable)} is invoked, {@link Throwable} will be passed to that last parameter.
33
+
* If there are multiple fallback method, one of the methods that has most closest superclass parameter of thrown object will be invoked.
* and if try to recover from {@link NumberFormatException}, {@code String fallbackMethod(String parameter, IllegalArgumentException exception)} will be invoked.
40
+
* and if try to fallback from {@link NumberFormatException}, {@code String fallbackMethod(String parameter, IllegalArgumentException exception)} will be invoked.
40
41
* </pre>
41
42
*/
42
43
publicclassFallbackMethod {
@@ -49,37 +50,49 @@ public class FallbackMethod {
49
50
/**
50
51
* create a fallbackMethod method.
51
52
*
52
-
* @param recoveryMethodName fallbackMethod method name
53
-
* @param originalMethod will be used for checking return type and parameter types of the fallbackMethod method
54
-
* @param args arguments those were passed to the original method. They will be passed to the fallbackMethod method.
55
-
* @param target target object the fallbackMethod method will be invoked
56
-
* @throws NoSuchMethodException will be thrown, if fallbackMethod method is not found
53
+
* @param recoveryMethods configured and found recovery methods for this invocation
54
+
* @param originalMethodReturnType the return type of the original source method
55
+
* @param args arguments those were passed to the original method. They will be passed to the fallbackMethod method.
56
+
* @param target target object the fallbackMethod method will be invoked
if (methods.get(recoveryParams[recoveryParams.length - 1]) != null) {
180
+
thrownewIllegalStateException("You have more that one fallback method that cover the same exception type " + recoveryParams[recoveryParams.length - 1].getName());
0 commit comments