.withMaxErrorRetry(maxErrorRetries) .withProtocol(sslEnabled ? Protocol.HTTPS : Protocol.HTTP) .withConnectionTimeout(toIntExact(connectTimeout.toMillis()))
.withMaxErrorRetry(maxErrorRetries) .withProtocol(sslEnabled ? Protocol.HTTPS : Protocol.HTTP) .withConnectionTimeout(toIntExact(connectTimeout.toMillis()))
private AmazonDynamoDBClient getDynamoDBClient(Configuration conf) { ClientConfiguration clientConfig = new ClientConfiguration().withMaxErrorRetry(1); applyProxyConfiguration(clientConfig, conf); return new AmazonDynamoDBClient(getAWSCredentialsProvider(conf), clientConfig); }
private AmazonDynamoDBClient getDynamoDBClient(Configuration conf) { ClientConfiguration clientConfig = new ClientConfiguration().withMaxErrorRetry(1); applyProxyConfiguration(clientConfig, conf); return new AmazonDynamoDBClient(getAWSCredentialsProvider(conf), clientConfig); }
clientConfig = clientConfig.withMaxErrorRetry(maxRetries);
if (conf.containsKey(CONF_MAX_ERROR_RETRY)) { int n = Integer.parseInt(conf.get(CONF_MAX_ERROR_RETRY)); cc = cc.withMaxErrorRetry(n);
@Override public CacheValue load(@Nonnull final Key<?> key) { log.debug("Creating a new AmazonWebServiceClient client for {}", key); final STSAssumeRoleSessionCredentialsProvider tempCredentials = new STSAssumeRoleSessionCredentialsProvider .Builder(buildRoleArn(key.accountId), ROLE_SESSION_NAME).withStsClient(awsSecurityTokenService) .build(); final String builderName = key.type.getName() + "Builder"; final Class<?> className = ClassUtils.resolveClassName(builderName, ClassUtils.getDefaultClassLoader()); final Method method = ClassUtils.getStaticMethod(className, "standard"); Assert.notNull(method, "Could not find standard() method in class:'" + className.getName() + "'"); final AwsClientBuilder<?, ?> builder = (AwsClientBuilder<?, ?>) ReflectionUtils.invokeMethod(method, null); builder.withCredentials(tempCredentials); builder.withRegion(key.region.getName()); builder.withClientConfiguration(new ClientConfiguration().withMaxErrorRetry(MAX_ERROR_RETRY)); final AmazonWebServiceClient client = (AmazonWebServiceClient) builder.build(); return new CacheValue(client, tempCredentials); } };
public void init(boolean connect) { AWSCredentials credentials; if (!Strings.isNullOrEmpty(accessKey) || !Strings.isNullOrEmpty(secretKey)) { credentials = new BasicAWSCredentials(accessKey, secretKey); } else { credentials = new AnonymousAWSCredentials(); } AmazonS3ClientBuilder builder = AmazonS3ClientBuilder.standard() .withCredentials(new AWSStaticCredentialsProvider(credentials)) .withClientConfiguration(new ClientConfiguration() .withMaxConnections(Runtime.getRuntime().availableProcessors() * 10) .withMaxErrorRetry(50)); if (!Strings.isNullOrEmpty(region)) { builder = builder.withRegion(region); } if (!Strings.isNullOrEmpty(endpoint)) { builder = builder.withEndpointConfiguration(new AwsClientBuilder.EndpointConfiguration(endpoint, null)); } this.client = builder.build(); if (connect) { // testing connection this.client.listObjects(bucket); } }
.withMaxErrorRetry(maxErrorRetries) .withProtocol(sslEnabled ? Protocol.HTTPS : Protocol.HTTP) .withConnectionTimeout(Ints.checkedCast(connectTimeout.toMillis()))
.withMaxErrorRetry(maxErrorRetries) .withProtocol(sslEnabled ? Protocol.HTTPS : Protocol.HTTP) .withConnectionTimeout(toIntExact(connectTimeout.toMillis()))
c.withLocalAddress(ina); c.withMaxConnections(1); c.withMaxErrorRetry(1); c.withPreemptiveBasicProxyAuth(true); c.withProtocol(Protocol.HTTP);
.withConnectionTTL(config.get(Constants.DYNAMODB_CLIENT_CONN_TTL)) .withMaxConnections(config.get(Constants.DYNAMODB_CLIENT_MAX_CONN)) .withMaxErrorRetry(config.get(Constants.DYNAMODB_CLIENT_MAX_ERROR_RETRY)) .withGzip(config.get(Constants.DYNAMODB_CLIENT_USE_GZIP)) .withReaper(config.get(Constants.DYNAMODB_CLIENT_USE_REAPER))
.withMaxErrorRetry(maxErrorRetries) .withProtocol(sslEnabled ? Protocol.HTTPS : Protocol.HTTP) .withConnectionTimeout(toIntExact(connectTimeout.toMillis()))
@Override public Statement apply(Statement base, Description description) { assumeTrue(dynamoDbOnline.get(this.port)); String url = "http://localhost:" + this.port; this.amazonDynamoDB = AmazonDynamoDBAsyncClientBuilder.standard() .withCredentials(new AWSStaticCredentialsProvider(new BasicAWSCredentials("", ""))) .withClientConfiguration( new ClientConfiguration() .withMaxErrorRetry(0) .withConnectionTimeout(1000)) .withEndpointConfiguration( new AwsClientBuilder.EndpointConfiguration(url, Regions.DEFAULT_REGION.getName())) .build(); try { this.amazonDynamoDB.listTables(); } catch (SdkClientException e) { logger.warn("Tests not running because no DynamoDb on " + url, e); assumeNoException(e); } return super.apply(base, description); }
assertEquals(c.getMaxConnections(), 2); c.withMaxErrorRetry(1); assertEquals(c.getMaxErrorRetry(), 1); c.setMaxErrorRetry(2);
.withClientConfiguration( new ClientConfiguration() .withMaxErrorRetry(0) .withConnectionTimeout(1000)) .withEndpointConfiguration(