Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,10 @@ public AwsObjectStorage(BucketURI bucketURI, Map<String, String> tagging,
}
this.checksumAlgorithm = checksumAlgorithm;

Supplier<S3AsyncClient> clientSupplier = () -> newS3Client(bucketURI.endpoint(), bucketURI.region(), bucketURI.extensionBool(PATH_STYLE_KEY, false), credentialsProviders, getMaxObjectStorageConcurrency());
long apiCallTimeoutMs = Long.parseLong(bucketURI.extensionString(BucketURI.API_CALL_TIMEOUT_KEY, "30000"));
long apiCallAttemptTimeoutMs = Long.parseLong(bucketURI.extensionString(BucketURI.API_CALL_ATTEMPT_TIMEOUT_KEY, "10000"));

Supplier<S3AsyncClient> clientSupplier = () -> newS3Client(bucketURI.endpoint(), bucketURI.region(), bucketURI.extensionBool(PATH_STYLE_KEY, false), credentialsProviders, getMaxObjectStorageConcurrency(), apiCallTimeoutMs, apiCallAttemptTimeoutMs);
this.writeS3Client = clientSupplier.get();
this.readS3Client = readWriteIsolate ? clientSupplier.get() : writeS3Client;
}
Expand Down Expand Up @@ -413,7 +416,7 @@ private String range(long start, long end) {
}

protected S3AsyncClient newS3Client(String endpoint, String region, boolean forcePathStyle,
List<AwsCredentialsProvider> credentialsProviders, int maxConcurrency) {
List<AwsCredentialsProvider> credentialsProviders, int maxConcurrency, long apiCallTimeoutMs, long apiCallAttemptTimeoutMs) {
S3AsyncClientBuilder builder = S3AsyncClient.builder().region(Region.of(region));
if (StringUtils.isNotBlank(endpoint)) {
builder.endpointOverride(URI.create(endpoint));
Expand All @@ -427,14 +430,14 @@ protected S3AsyncClient newS3Client(String endpoint, String region, boolean forc
builder.httpClient(httpClient);
builder.serviceConfiguration(c -> c.pathStyleAccessEnabled(forcePathStyle));
builder.credentialsProvider(newCredentialsProviderChain(credentialsProviders));
builder.overrideConfiguration(clientOverrideConfiguration());
builder.overrideConfiguration(clientOverrideConfiguration(apiCallTimeoutMs, apiCallAttemptTimeoutMs));
return builder.build();
}

protected ClientOverrideConfiguration clientOverrideConfiguration() {
protected ClientOverrideConfiguration clientOverrideConfiguration(long apiCallTimeoutMs, long apiCallAttemptTimeoutMs) {
return ClientOverrideConfiguration.builder()
.apiCallTimeout(Duration.ofSeconds(30))
.apiCallAttemptTimeout(Duration.ofSeconds(10))
.apiCallTimeout(Duration.ofMillis(apiCallTimeoutMs))
.apiCallAttemptTimeout(Duration.ofMillis(apiCallAttemptTimeoutMs))
.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ public class BucketURI {
private static final String REGION_KEY = "region";
public static final String ACCESS_KEY_KEY = "accessKey";
public static final String SECRET_KEY_KEY = "secretKey";
public static final String API_CALL_TIMEOUT_KEY = "apiCallTimeoutMs";
public static final String API_CALL_ATTEMPT_TIMEOUT_KEY = "apiCallAttemptTimeoutMs";
private static final String EMPTY_STRING = "";
private final short bucketId;
private final String protocol;
Expand Down
Loading