Did this page help you?

   Yes   No   Tell us about it...

com.amazonaws.services.simpleworkflow.flow.interceptors
Class ExponentialRetryPolicy

java.lang.Object
  extended by com.amazonaws.services.simpleworkflow.flow.interceptors.RetryPolicyBase
      extended by com.amazonaws.services.simpleworkflow.flow.interceptors.ExponentialRetryPolicy
All Implemented Interfaces:
RetryPolicy

public class ExponentialRetryPolicy
extends RetryPolicyBase


Constructor Summary
ExponentialRetryPolicy(long initialRetryIntervalSeconds)
           
 
Method Summary
 double getBackoffCoefficient()
           
 long getInitialRetryIntervalSeconds()
           
 int getMaximumAttempts()
           
 long getMaximumRetryIntervalSeconds()
           
 long getRetryExpirationIntervalSeconds()
           
 long nextRetryDelaySeconds(Date firstAttempt, Date recordedFailure, int numberOfTries)
           
 void setBackoffCoefficient(double backoffCoefficient)
          Coefficient used to calculate the next retry interval.
 void setMaximumAttempts(int maximumAttempts)
          Maximum number of attempts.
 void setMaximumRetryIntervalSeconds(long maximumRetryIntervalSeconds)
          Set the upper limit of retry interval.
 void setRetryExpirationIntervalSeconds(long retryExpirationIntervalSeconds)
          Stop retrying after the specified interval.
 void validate()
          Performs the following three validation checks for ExponentialRetry Policy: 1) initialRetryIntervalSeconds is not greater than maximumRetryIntervalSeconds 2) initialRetryIntervalSeconds is not greater than retryExpirationIntervalSeconds
 ExponentialRetryPolicy withBackoffCoefficient(double backoffCoefficient)
           
 ExponentialRetryPolicy withExceptionsToExclude(Collection<Class<? extends Throwable>> exceptionsToRetry)
          The exception types that should not be retried.
 ExponentialRetryPolicy withExceptionsToRetry(Collection<Class<? extends Throwable>> exceptionsToRetry)
          The exception types that cause operation being retried.
 ExponentialRetryPolicy withMaximumAttempts(int maximumAttempts)
           
 ExponentialRetryPolicy withMaximumRetryIntervalSeconds(long maximumRetryIntervalSeconds)
           
 ExponentialRetryPolicy withRetryExpirationIntervalSeconds(long retryExpirationIntervalSeconds)
           
 
Methods inherited from class com.amazonaws.services.simpleworkflow.flow.interceptors.RetryPolicyBase
getExceptionsToExclude, getExceptionsToRetry, isRetryable, setExceptionsToExclude, setExceptionsToRetry
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExponentialRetryPolicy

public ExponentialRetryPolicy(long initialRetryIntervalSeconds)
Method Detail

getInitialRetryIntervalSeconds

public long getInitialRetryIntervalSeconds()

getMaximumRetryIntervalSeconds

public long getMaximumRetryIntervalSeconds()

setMaximumRetryIntervalSeconds

public void setMaximumRetryIntervalSeconds(long maximumRetryIntervalSeconds)
Set the upper limit of retry interval. No limit by default.


withMaximumRetryIntervalSeconds

public ExponentialRetryPolicy withMaximumRetryIntervalSeconds(long maximumRetryIntervalSeconds)

getRetryExpirationIntervalSeconds

public long getRetryExpirationIntervalSeconds()

setRetryExpirationIntervalSeconds

public void setRetryExpirationIntervalSeconds(long retryExpirationIntervalSeconds)
Stop retrying after the specified interval.


withRetryExpirationIntervalSeconds

public ExponentialRetryPolicy withRetryExpirationIntervalSeconds(long retryExpirationIntervalSeconds)

getBackoffCoefficient

public double getBackoffCoefficient()

setBackoffCoefficient

public void setBackoffCoefficient(double backoffCoefficient)
Coefficient used to calculate the next retry interval. The following formula is used: initialRetryIntervalSeconds * Math.pow(backoffCoefficient, numberOfTries - 2)


withBackoffCoefficient

public ExponentialRetryPolicy withBackoffCoefficient(double backoffCoefficient)

getMaximumAttempts

public int getMaximumAttempts()

setMaximumAttempts

public void setMaximumAttempts(int maximumAttempts)
Maximum number of attempts. The first retry is second attempt.


withMaximumAttempts

public ExponentialRetryPolicy withMaximumAttempts(int maximumAttempts)

withExceptionsToRetry

public ExponentialRetryPolicy withExceptionsToRetry(Collection<Class<? extends Throwable>> exceptionsToRetry)
The exception types that cause operation being retried. Subclasses of the specified types are also included. Default is Throwable.class which means retry any exceptions.

Overrides:
withExceptionsToRetry in class RetryPolicyBase

withExceptionsToExclude

public ExponentialRetryPolicy withExceptionsToExclude(Collection<Class<? extends Throwable>> exceptionsToRetry)
The exception types that should not be retried. Subclasses of the specified types are also not retried. Default is empty list.

Overrides:
withExceptionsToExclude in class RetryPolicyBase

nextRetryDelaySeconds

public long nextRetryDelaySeconds(Date firstAttempt,
                                  Date recordedFailure,
                                  int numberOfTries)
Returns:
Time to the next retry. FlowConstants.NONE means stop retrying.

validate

public void validate()
              throws IllegalStateException
Performs the following three validation checks for ExponentialRetry Policy: 1) initialRetryIntervalSeconds is not greater than maximumRetryIntervalSeconds 2) initialRetryIntervalSeconds is not greater than retryExpirationIntervalSeconds

Throws:
IllegalStateException


Copyright © 2010 Amazon Web Services, Inc. All Rights Reserved.