Package com.amazonaws.services.simpleworkflow.flow.interceptors

Examples of com.amazonaws.services.simpleworkflow.flow.interceptors.ExponentialRetryPolicy


        }
    }

    @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;
View Full Code Here


        return isVoidReturnType;
    }

    private ExponentialRetryPolicy createExponentialRetryPolicy(ExponentialRetry retryAnnotation) {

        ExponentialRetryPolicy retryPolicy = new ExponentialRetryPolicy(retryAnnotation.initialRetryIntervalSeconds()).withExceptionsToRetry(
                Arrays.asList(retryAnnotation.exceptionsToRetry())).withExceptionsToExclude(
                Arrays.asList(retryAnnotation.excludeExceptions())).withBackoffCoefficient(retryAnnotation.backoffCoefficient()).withMaximumRetryIntervalSeconds(
                retryAnnotation.maximumRetryIntervalSeconds()).withRetryExpirationIntervalSeconds(
                retryAnnotation.retryExpirationSeconds()).withMaximumAttempts(retryAnnotation.maximumAttempts());

        retryPolicy.validate();
        return retryPolicy;
    }
View Full Code Here

        // Activities client could be decorated directly using CronDecorator and RetryDecorator.
        // But executors are used instead to enable updates to invocationHistory.
        CronInvocationSchedule cronSchedule = new CronInvocationSchedule(options.getCronExpression(), expiration, tz);
        AsyncScheduledExecutor scheduledExecutor = new AsyncScheduledExecutor(cronSchedule, clock);
        ExponentialRetryPolicy retryPolicy = createRetryPolicyFromOptions(options);
        final AsyncRetryingExecutor retryExecutor = new AsyncRetryingExecutor(retryPolicy, clock);

        scheduledExecutor.execute(new AsyncRunnable() {

            @Override
View Full Code Here

        };
    }

    @SuppressWarnings("unchecked")
    private ExponentialRetryPolicy createRetryPolicyFromOptions(CronWithRetryWorkflowOptions options) {
        ExponentialRetryPolicy retryPolicy = new ExponentialRetryPolicy(options.getInitialRetryIntervalSeconds());
        retryPolicy.setBackoffCoefficient(options.getBackoffCoefficient());
        try {
            List<String> exceptionsToRetryClasses = options.getExceptionsToRetry();
            if (exceptionsToRetryClasses != null) {
                List<Class<? extends Throwable>> exceptionsToRetry = new ArrayList<Class<? extends Throwable>>();
                for (String exceptionType : exceptionsToRetryClasses) {
                    exceptionsToRetry.add((Class<? extends Throwable>) Class.forName(exceptionType));
                }
                retryPolicy.setExceptionsToRetry(exceptionsToRetry);
            }
            List<String> exceptionsToExcludeClasses = options.getExceptionsToExclude();
            if (exceptionsToExcludeClasses != null) {
                List<Class<? extends Throwable>> exceptionsToExclude = new ArrayList<Class<? extends Throwable>>();
                for (String exceptionType : exceptionsToExcludeClasses) {
                    exceptionsToExclude.add((Class<? extends Throwable>) Class.forName(exceptionType));
                }
                retryPolicy.setExceptionsToExclude(exceptionsToExclude);
            }
        }
        catch (ClassNotFoundException e) {
            throw new IllegalArgumentException("Invalid options: " + options, e);
        }
        retryPolicy.setMaximumAttempts(options.getMaximumAttempts());
        retryPolicy.setMaximumRetryIntervalSeconds(options.getMaximumRetryIntervalSeconds());
        retryPolicy.setRetryExpirationIntervalSeconds(options.getRetryExpirationIntervalSeconds());
        return retryPolicy;
    }
View Full Code Here

        }
    }

    @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;
View Full Code Here

        return isVoidReturnType;
    }

    private ExponentialRetryPolicy createExponentialRetryPolicy(ExponentialRetry retryAnnotation) {

        ExponentialRetryPolicy retryPolicy = new ExponentialRetryPolicy(retryAnnotation.initialRetryIntervalSeconds()).withExceptionsToRetry(
                Arrays.asList(retryAnnotation.exceptionsToRetry())).withExceptionsToExclude(
                Arrays.asList(retryAnnotation.excludeExceptions())).withBackoffCoefficient(retryAnnotation.backoffCoefficient()).withMaximumRetryIntervalSeconds(
                retryAnnotation.maximumRetryIntervalSeconds()).withRetryExpirationIntervalSeconds(
                retryAnnotation.retryExpirationSeconds()).withMaximumAttempts(retryAnnotation.maximumAttempts());

        retryPolicy.validate();
        return retryPolicy;
    }
View Full Code Here

        }
    }

    @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;
View Full Code Here

        return isVoidReturnType;
    }

    private ExponentialRetryPolicy createExponentialRetryPolicy(ExponentialRetry retryAnnotation) {

        ExponentialRetryPolicy retryPolicy = new ExponentialRetryPolicy(retryAnnotation.initialRetryIntervalSeconds()).withExceptionsToRetry(
                Arrays.asList(retryAnnotation.exceptionsToRetry())).withExceptionsToExclude(
                Arrays.asList(retryAnnotation.excludeExceptions())).withBackoffCoefficient(retryAnnotation.backoffCoefficient()).withMaximumRetryIntervalSeconds(
                retryAnnotation.maximumRetryIntervalSeconds()).withRetryExpirationIntervalSeconds(
                retryAnnotation.retryExpirationSeconds()).withMaximumAttempts(retryAnnotation.maximumAttempts());

        retryPolicy.validate();
        return retryPolicy;
    }
View Full Code Here

@Aspect
public class ExponentialRetryAspect {
   
    @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);
       
        @SuppressWarnings("rawtypes")
        RetryCallable retryCallable = new RetryCallable() {
           
            @Override
View Full Code Here

        return interceptor.execute();
    }
   
    private ExponentialRetryPolicy createExponentialRetryPolicy(ExponentialRetry retryAnnotation) {
       
        ExponentialRetryPolicy retryPolicy = new ExponentialRetryPolicy(retryAnnotation.initialRetryIntervalSeconds())
            .withExceptionsToRetry(Arrays.asList(retryAnnotation.exceptionsToRetry()))
            .withExceptionsToExclude(Arrays.asList(retryAnnotation.excludeExceptions()))
            .withBackoffCoefficient(retryAnnotation.backoffCoefficient())
            .withMaximumRetryIntervalSeconds(retryAnnotation.maximumRetryIntervalSeconds())
            .withRetryExpirationIntervalSeconds(retryAnnotation.retryExpirationSeconds())
            .withMaximumAttempts(retryAnnotation.maximumAttempts());

        retryPolicy.validate();
        return retryPolicy;
    }
View Full Code Here

TOP

Related Classes of com.amazonaws.services.simpleworkflow.flow.interceptors.ExponentialRetryPolicy

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.