@@ -73,6 +73,7 @@ public class AsyncHttpClientConfig {
73
73
private final List <IOExceptionFilter > ioExceptionFilters ;
74
74
private final int requestCompressionLevel ;
75
75
private final int maxRequestRetry ;
76
+ private final boolean allowSslConnectionPool ;
76
77
77
78
private AsyncHttpClientConfig (int maxTotalConnections ,
78
79
int maxConnectionPerHost ,
@@ -94,7 +95,9 @@ private AsyncHttpClientConfig(int maxTotalConnections,
94
95
List <RequestFilter > requestFilters ,
95
96
List <ResponseFilter > responseFilters ,
96
97
List <IOExceptionFilter > ioExceptionFilters ,
97
- int requestCompressionLevel , int maxRequestRetry ) {
98
+ int requestCompressionLevel ,
99
+ int maxRequestRetry ,
100
+ boolean allowSslConnectionCaching ) {
98
101
99
102
this .maxTotalConnections = maxTotalConnections ;
100
103
this .maxConnectionPerHost = maxConnectionPerHost ;
@@ -117,6 +120,7 @@ private AsyncHttpClientConfig(int maxTotalConnections,
117
120
this .requestCompressionLevel = requestCompressionLevel ;
118
121
this .maxRequestRetry = maxRequestRetry ;
119
122
this .reaper = reaper ;
123
+ this .allowSslConnectionPool = allowSslConnectionCaching ;
120
124
121
125
if (applicationThreadPool == null ) {
122
126
this .applicationThreadPool = Executors .newCachedThreadPool ();
@@ -362,6 +366,15 @@ public int getMaxRequestRetry() {
362
366
return maxRequestRetry ;
363
367
}
364
368
369
+ /**
370
+ * Return true is SSL connection polling is enabled. Default is true.
371
+ * @return
372
+ */
373
+ public boolean isSslConnectionPoolEnabled () {
374
+ return allowSslConnectionPool ;
375
+ }
376
+
377
+
365
378
/**
366
379
* Builder for an {@link AsyncHttpClient}
367
380
*/
@@ -401,6 +414,7 @@ public Thread newThread(Runnable r) {
401
414
private final List <RequestFilter > requestFilters = new LinkedList <RequestFilter >();
402
415
private final List <ResponseFilter > responseFilters = new LinkedList <ResponseFilter >();
403
416
private final List <IOExceptionFilter > ioExceptionFilters = new LinkedList <IOExceptionFilter >();
417
+ private boolean allowSslConnectionPool = true ;
404
418
405
419
public Builder () {
406
420
}
@@ -738,6 +752,16 @@ public Builder setMaxRequestRetry(int maxRequestRetry) {
738
752
return this ;
739
753
}
740
754
755
+ /**
756
+ * Return true is if connections pooling is enabled.
757
+ * @param allowSslConnectionPool true if enabled
758
+ * @return true is if connections pooling is enabled.
759
+ */
760
+ public Builder setAllowSslConnectionPool (boolean allowSslConnectionPool ) {
761
+ this .allowSslConnectionPool = allowSslConnectionPool ;
762
+ return this ;
763
+ }
764
+
741
765
/**
742
766
* Create a config builder with values taken from the given prototype configuration.
743
767
*
@@ -796,7 +820,8 @@ public AsyncHttpClientConfig build() {
796
820
responseFilters ,
797
821
ioExceptionFilters ,
798
822
requestCompressionLevel ,
799
- maxRequestRetry );
823
+ maxRequestRetry ,
824
+ allowSslConnectionPool );
800
825
}
801
826
}
802
827
}
0 commit comments