@Around("execution(@com.amazonaws.services.simpleworkflow.flow.annotations.ExponentialRetry * *(..)) && @annotation(retryAnnotation)")
public Object retry(final ProceedingJoinPoint pjp, ExponentialRetry retryAnnotation) throws Throwable {
ExponentialRetryPolicy retryPolicy = createExponentialRetryPolicy(retryAnnotation);
WorkflowClock clock = new DecisionContextProviderImpl().getDecisionContext().getWorkflowClock();
AsyncExecutor executor = new AsyncRetryingExecutor(retryPolicy, clock);
Settable<?> result;
if (isVoidReturnType(pjp)) {
result = null;
}
else {
result = new Settable<Object>();
}
DecoratorInvocationHandler handler = new DecoratorInvocationHandler(pjp, result);
executor.execute(handler);
return result;
}