Example usage for com.amazonaws.retry PredefinedRetryPolicies getDefaultRetryPolicyWithCustomMaxRetries

List of usage examples for com.amazonaws.retry PredefinedRetryPolicies getDefaultRetryPolicyWithCustomMaxRetries

Introduction

In this page you can find the example usage for com.amazonaws.retry PredefinedRetryPolicies getDefaultRetryPolicyWithCustomMaxRetries.

Prototype

public static RetryPolicy getDefaultRetryPolicyWithCustomMaxRetries(int maxErrorRetry) 

Source Link

Document

Returns the SDK default retry policy with the specified max retry count.

Usage

From source file:com.netflix.genie.web.configs.aws.AwsS3Config.java

License:Apache License

/**
 * A bean providing a client to work with S3.
 *
 * @param noOfS3Retries          No. of S3 request retries
 * @param awsCredentialsProvider A credentials provider used to instantiate the client.
 * @return An amazon s3 client object/*from  w w  w .j  a v  a  2 s  . c  o m*/
 */
@Bean
@ConditionalOnBean(AWSCredentialsProvider.class)
public AmazonS3Client genieS3Client(@Value("${genie.retry.s3.noOfRetries:5}") final int noOfS3Retries,
        final AWSCredentialsProvider awsCredentialsProvider) {
    final ClientConfiguration clientConfiguration = new ClientConfiguration()
            .withRetryPolicy(PredefinedRetryPolicies.getDefaultRetryPolicyWithCustomMaxRetries(noOfS3Retries));
    return new AmazonS3Client(awsCredentialsProvider, clientConfiguration);
}

From source file:com.netflix.genie.web.configs.aws.GenieAwsS3AutoConfiguration.java

License:Apache License

/**
 * Default AWS client configuration that sets the number of retries provided by the user.
 *
 * @param retryProperties The properties related to retry configuration in Genie
 * @return The client configuration to use for all built AWS clients
 *///  w  ww .j av a  2 s.com
@Bean
@ConditionalOnMissingBean(name = "genieAwsClientConfiguration", value = ClientConfiguration.class)
public ClientConfiguration genieAwsClientConfiguration(final RetryProperties retryProperties) {
    return new ClientConfiguration().withRetryPolicy(PredefinedRetryPolicies
            .getDefaultRetryPolicyWithCustomMaxRetries(retryProperties.getS3().getNoOfRetries()));
}