This is an automated email from the ASF dual-hosted git repository.

btellier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git


The following commit(s) were added to refs/heads/master by this push:
     new 033cb92284 [FIX] S3: apply timeouts configuration (#1202)
033cb92284 is described below

commit 033cb92284958e64b80ae1cd5738f3608791e5c6
Author: Benoit TELLIER <btell...@linagora.com>
AuthorDate: Thu Sep 22 09:49:55 2022 +0700

    [FIX] S3: apply timeouts configuration (#1202)
---
 .../james/blob/objectstorage/aws/S3BlobStoreDAO.java     | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git 
a/server/blob/blob-s3/src/main/java/org/apache/james/blob/objectstorage/aws/S3BlobStoreDAO.java
 
b/server/blob/blob-s3/src/main/java/org/apache/james/blob/objectstorage/aws/S3BlobStoreDAO.java
index 8315b14ae2..970a09e557 100644
--- 
a/server/blob/blob-s3/src/main/java/org/apache/james/blob/objectstorage/aws/S3BlobStoreDAO.java
+++ 
b/server/blob/blob-s3/src/main/java/org/apache/james/blob/objectstorage/aws/S3BlobStoreDAO.java
@@ -109,10 +109,7 @@ public class S3BlobStoreDAO implements BlobStoreDAO, 
Startable, Closeable {
         client = S3AsyncClient.builder()
             .credentialsProvider(StaticCredentialsProvider.create(
                 AwsBasicCredentials.create(authConfiguration.getAccessKeyId(), 
authConfiguration.getSecretKey())))
-            .httpClientBuilder(NettyNioAsyncHttpClient.builder()
-                
.tlsTrustManagersProvider(getTrustManagerProvider(configuration.getSpecificAuthConfiguration()))
-                .maxConcurrency(configuration.getHttpConcurrency())
-                .maxPendingConnectionAcquires(10_000))
+            .httpClientBuilder(httpClientBuilder(configuration))
             .endpointOverride(authConfiguration.getEndpoint())
             .region(configuration.getRegion().asAws())
             .serviceConfiguration(pathStyleAccess)
@@ -124,6 +121,17 @@ public class S3BlobStoreDAO implements BlobStoreDAO, 
Startable, Closeable {
             .build();
     }
 
+    private NettyNioAsyncHttpClient.Builder 
httpClientBuilder(S3BlobStoreConfiguration configuration) {
+        NettyNioAsyncHttpClient.Builder result = 
NettyNioAsyncHttpClient.builder()
+            
.tlsTrustManagersProvider(getTrustManagerProvider(configuration.getSpecificAuthConfiguration()))
+            .maxConcurrency(configuration.getHttpConcurrency())
+            .maxPendingConnectionAcquires(10_000);
+        configuration.getWriteTimeout().ifPresent(result::writeTimeout);
+        configuration.getReadTimeout().ifPresent(result::readTimeout);
+        
configuration.getConnectionTimeout().ifPresent(result::connectionTimeout);
+        return result;
+    }
+
     private TlsTrustManagersProvider 
getTrustManagerProvider(AwsS3AuthConfiguration configuration) {
         try {
             TrustManagerFactory trustManagerFactory = 
TrustManagerFactory.getInstance(


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org
For additional commands, e-mail: notifications-h...@james.apache.org

Reply via email to