public long nextRetryDelaySeconds()

in src/main/java/com/amazonaws/services/simpleworkflow/flow/interceptors/ExponentialRetryPolicy.java [136:155]


    public long nextRetryDelaySeconds(Date firstAttempt, Date recordedFailure, int numberOfTries) {

        if (numberOfTries < 2) {
            throw new IllegalArgumentException("attempt is less then 2: " + numberOfTries);
        }

        if (maximumAttempts > FlowConstants.NONE && numberOfTries > maximumAttempts) {
            return FlowConstants.NONE;
        }

        long result = (long) (initialRetryIntervalSeconds * Math.pow(backoffCoefficient, numberOfTries - 2));
        result = maximumRetryIntervalSeconds > FlowConstants.NONE ? Math.min(result, maximumRetryIntervalSeconds) : result;
        int secondsSinceFirstAttempt = (int) ((recordedFailure.getTime() - firstAttempt.getTime()) / 1000);
        if (retryExpirationIntervalSeconds > FlowConstants.NONE
                && secondsSinceFirstAttempt + result >= retryExpirationIntervalSeconds) {
            return FlowConstants.NONE;
        }

        return result;
    }