iron-spi-aws/src/main/java/io/axway/iron/spi/aws/AwsUtils.java
public static <T> T performAmazonActionWithRetry(String actionLabel, Supplier<T> action, int retryLimit, int durationInMillis) {
        int retryCount = 0;
        do {
            try {
                return action.get();
            } catch (LimitExceededException | ProvisionedThroughputExceededException | KMSThrottlingException e) {
                // We should just wait a little time before trying again
                int remainingRetries = retryLimit - retryCount;
                LOG.debug("Amazon exception caught",
                          args -> args.add("exception", e.getClass().getName()).add("action", actionLabel).add("remainingRetryCount", remainingRetries));
            }
            sleepUntilInterrupted(actionLabel, durationInMillis);
        } while (retryCount++ < retryLimit);
        throw new AwsException("Limit exceeded, all retries failed", args -> args.add("action", actionLabel).add("retryLimit", retryLimit));
    }
public static <T> T performAmazonActionWithRetry(String actionLabel, Supplier<T> action, int retryLimit, int durationInMillis) {
        int retryCount = 0;
        do {
            try {
                return action.get();
            } catch (LimitExceededException | ProvisionedThroughputExceededException | KMSThrottlingException e) {
                // We should just wait a little time before trying again
                int remainingRetries = retryLimit - retryCount;
                LOG.debug("Amazon exception caught",
                          args -> args.add("exception", e.getClass().getName()).add("action", actionLabel).add("remainingRetryCount", remainingRetries));
            }
            sleepUntilInterrupted(actionLabel, durationInMillis);
        } while (retryCount++ < retryLimit);
        throw new AwsException("Limit exceeded, all retries failed", args -> args.add("action", actionLabel).add("retryLimit", retryLimit));
    }
public static < T > T performAmazonActionWithRetry ( String actionLabel , Supplier < T > action , int retryLimit , int durationInMillis ) { int retryCount = 0 ; do { try { return action . get ( ) ; } catch ( LimitExceededException | ProvisionedThroughputExceededException | KMSThrottlingException e ) { // We should just wait a little time before trying again int remainingRetries = retryLimit - retryCount ; LOG . debug ( "Amazon exception caught" , args -> args . add ( "exception" , e . getClass ( ) . getName ( ) ) . add ( "action" , actionLabel ) . add ( "remainingRetryCount" , remainingRetries ) ) ; } sleepUntilInterrupted ( actionLabel , durationInMillis ) ; } while ( retryCount ++ < retryLimit ) ; throw new AwsException ( "Limit exceeded, all retries failed" , args -> args . add ( "action" , actionLabel ) . add ( "retryLimit" , retryLimit ) ) ; }
Handle retry for amazon quotas

@param <T> the action return type
@param actionLabel action label used for logging purpose only
@param action the action to retry
@param retryLimit retry number limit
@param durationInMillis duration between each retry
@return the action result
@throws AwsException after retry exhausted
Handle retry for amazon quotas