| Total Complexity | 3 |
| Total Lines | 23 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | 1 | package io.mcarle.sciurus.retry; |
|
| 9 | @Aspect |
||
| 10 | 1 | public class RetryAspect { |
|
| 11 | |||
| 12 | /** |
||
| 13 | * Matches any execution of any method |
||
| 14 | */ |
||
| 15 | @Pointcut("execution(* *(..))") |
||
| 16 | void anyMethod() { |
||
| 17 | } |
||
| 18 | |||
| 19 | /** |
||
| 20 | * Matches any method, which is annotated with {@link Retry} |
||
| 21 | */ |
||
| 22 | @Pointcut("@annotation(retry)") |
||
| 23 | void retryAnnotated(Retry retry) { |
||
| 24 | } |
||
| 25 | |||
| 26 | @Around(value = "anyMethod() && retryAnnotated(retry)", argNames = "joinPoint,retry") |
||
| 27 | public Object executionOfAnyMethodAnnotatedWithRetry( |
||
| 28 | ProceedingJoinPoint joinPoint, |
||
| 29 | Retry retry |
||
| 30 | ) throws Throwable { |
||
| 31 | 1 | return RetryAspectHandler.executeAndRetry(joinPoint, retry); |
|
| 32 | } |
||
| 34 |