@@ -67,6 +67,7 @@ public class S3Config extends ObjectConfig<S3Config> {
67
67
public static final int DEFAULT_INITIAL_RETRY_DELAY = 1000 ; // ms
68
68
public static final int DEFAULT_RETRY_LIMIT = 3 ;
69
69
public static final int DEFAULT_RETRY_BUFFER_SIZE = 2 * 1024 * 1024 ;
70
+ public static final int DEFAULT_MAX_CONNECTION_IDLE_TIME = 0 ;
70
71
71
72
protected static int defaultPort (Protocol protocol ) {
72
73
if (protocol == Protocol .HTTP ) return DEFAULT_HTTP_PORT ;
@@ -85,6 +86,7 @@ protected static int defaultPort(Protocol protocol) {
85
86
protected float faultInjectionRate = 0.0f ;
86
87
protected boolean signMetadataSearch = true ;
87
88
protected boolean useV2Signer = true ;
89
+ protected int maxConnectionIdleTime = DEFAULT_MAX_CONNECTION_IDLE_TIME ;
88
90
89
91
/**
90
92
* Empty constructor for internal use only!
@@ -131,6 +133,7 @@ public S3Config(S3Config other) {
131
133
this .faultInjectionRate = other .faultInjectionRate ;
132
134
this .signMetadataSearch = other .signMetadataSearch ;
133
135
this .useV2Signer = other .useV2Signer ;
136
+ this .maxConnectionIdleTime = other .maxConnectionIdleTime ;
134
137
}
135
138
136
139
@ Override
@@ -243,7 +246,7 @@ public void setRetryBufferSize(int retryBufferSize) {
243
246
public float getFaultInjectionRate () {
244
247
return faultInjectionRate ;
245
248
}
246
-
249
+
247
250
/**
248
251
* Sets the fault injection rate. Enables fault injection when this number is > 0. The rate is a ratio expressed as
249
252
* a decimal between 0 and 1. This is the rate at which faults (HTTP 500 errors) should randomly be injected into
@@ -281,6 +284,20 @@ public void setUseV2Signer(boolean useV2Signer) {
281
284
this .useV2Signer = useV2Signer ;
282
285
}
283
286
287
+ @ ConfigUriProperty
288
+ public int getMaxConnectionIdleTime () {
289
+ return maxConnectionIdleTime ;
290
+ }
291
+
292
+ /**
293
+ * Set the maximum amount of time (in milliseconds) to keep a connection alive and idle.
294
+ * This is a hint to the underlying connection pool, and is not guaranteed to be honored.
295
+ * A zero value indicates no limit to the life time.
296
+ */
297
+ public void setMaxConnectionIdleTime (int maxConnectionIdleTime ) {
298
+ this .maxConnectionIdleTime = maxConnectionIdleTime ;
299
+ }
300
+
284
301
public S3Config withUseVHost (boolean useVHost ) {
285
302
setUseVHost (useVHost );
286
303
return this ;
@@ -331,6 +348,11 @@ public S3Config withUseV2Signer(boolean useV2Signer) {
331
348
return this ;
332
349
}
333
350
351
+ public S3Config withMaxConnectionIdleTime (int maxConnectionIdleTime ) {
352
+ setMaxConnectionIdleTime (maxConnectionIdleTime );
353
+ return this ;
354
+ }
355
+
334
356
@ Override
335
357
public String toString () {
336
358
return "S3Config{" +
0 commit comments