-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
static resolution of FT methods (@Fallback.fallbackMethod, @BeforeRet…
…ry.methodName)
- Loading branch information
Showing
14 changed files
with
213 additions
and
120 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 3 additions & 26 deletions
29
...on/fault-tolerance/src/main/java/io/smallrye/faulttolerance/config/BeforeRetryConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,17 @@ | ||
package io.smallrye.faulttolerance.config; | ||
|
||
import java.lang.reflect.Method; | ||
|
||
import org.eclipse.microprofile.faulttolerance.exceptions.FaultToleranceDefinitionException; | ||
|
||
import io.smallrye.faulttolerance.api.BeforeRetry; | ||
import io.smallrye.faulttolerance.autoconfig.AutoConfig; | ||
import io.smallrye.faulttolerance.autoconfig.Config; | ||
import io.smallrye.faulttolerance.internal.BeforeRetryMethod; | ||
import io.smallrye.faulttolerance.internal.InterceptionPoint; | ||
|
||
@AutoConfig | ||
public interface BeforeRetryConfig extends BeforeRetry, Config { | ||
default void validate() { | ||
final String INVALID_BEFORE_RETRY_ON = "Invalid @BeforeRetry on "; | ||
|
||
Method guardedMethod; | ||
try { | ||
guardedMethod = method().reflect(); | ||
} catch (NoSuchMethodException e) { | ||
throw new FaultToleranceDefinitionException(e); | ||
} | ||
|
||
if (!"".equals(methodName())) { | ||
if (!BeforeRetry.DEFAULT.class.equals(value())) { | ||
throw new FaultToleranceDefinitionException(INVALID_BEFORE_RETRY_ON + method() | ||
+ ": before retry handler class and before retry method can't be specified both at the same time"); | ||
} | ||
|
||
BeforeRetryMethod beforeRetryMethod = BeforeRetryMethod.find( | ||
new InterceptionPoint(beanClass(), guardedMethod), methodName()); | ||
if (beforeRetryMethod == null) { | ||
throw new FaultToleranceDefinitionException(INVALID_BEFORE_RETRY_ON + method() | ||
+ ": can't find before retry method '" + methodName() | ||
+ "' with no parameter and return type of void"); | ||
} | ||
if (!"".equals(methodName()) && !DEFAULT.class.equals(value())) { | ||
throw new FaultToleranceDefinitionException("Invalid @BeforeRetry on " + method() | ||
+ ": before retry handler class and before retry method can't be specified both at the same time"); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.