private void scheduleWithRetry()

in src/main/java/com/amazonaws/services/simpleworkflow/flow/interceptors/AsyncRetryingExecutor.java [62:95]


    private void scheduleWithRetry(final AsyncRunnable command, final Throwable failure,
                                   final int attempt, final long timeOfFirstAttempt, final long timeOfRecordedFailure) throws Throwable {
        long delay = -1;
        if (attempt > 1) {
            if (!retryPolicy.isRetryable(failure)) {
                throw failure;
            }
            Date firstAttempt;
            if (firstAttemptTime.get() == 0) {
                firstAttempt = new Date(timeOfFirstAttempt);
            } else {
                firstAttempt = new Date(firstAttemptTime.get());
            }
            delay = retryPolicy.nextRetryDelaySeconds(firstAttempt, new Date(timeOfRecordedFailure), attempt);
            if (delay < 0) {
                throw failure;
            }
        }

        if (delay > 0) {
            Promise<Void> timer = clock.createTimer(delay);
            new Task(timer) {

                @Override
                protected void doExecute() throws Throwable {
                    invoke(command, attempt, timeOfFirstAttempt);
                }
            };
        }
        else {
            invoke(command, attempt, timeOfFirstAttempt);
        }

    }