List of usage examples for com.amazonaws ClientConfiguration getMaxErrorRetry
public int getMaxErrorRetry()
From source file:com.cloud.utils.S3Utils.java
License:Apache License
private static AmazonS3 acquireClient(final ClientOptions clientOptions) { final AWSCredentials credentials = new BasicAWSCredentials(clientOptions.getAccessKey(), clientOptions.getSecretKey()); final ClientConfiguration configuration = new ClientConfiguration(); if (clientOptions.isHttps() != null) { configuration.setProtocol(clientOptions.isHttps() == true ? HTTPS : HTTP); }// w ww .ja v a2 s . co m if (clientOptions.getConnectionTimeout() != null) { configuration.setConnectionTimeout(clientOptions.getConnectionTimeout()); } if (clientOptions.getMaxErrorRetry() != null) { configuration.setMaxErrorRetry(clientOptions.getMaxErrorRetry()); } if (clientOptions.getSocketTimeout() != null) { configuration.setSocketTimeout(clientOptions.getSocketTimeout()); } if (LOGGER.isDebugEnabled()) { LOGGER.debug(format( "Creating S3 client with configuration: [protocol: %1$s, connectionTimeOut: " + "%2$s, maxErrorRetry: %3$s, socketTimeout: %4$s]", configuration.getProtocol(), configuration.getConnectionTimeout(), configuration.getMaxErrorRetry(), configuration.getSocketTimeout())); } final AmazonS3Client client = new AmazonS3Client(credentials, configuration); if (isNotBlank(clientOptions.getEndPoint())) { if (LOGGER.isDebugEnabled()) { LOGGER.debug(format("Setting the end point for S3 client %1$s to %2$s.", client, clientOptions.getEndPoint())); } client.setEndpoint(clientOptions.getEndPoint()); } return client; }