Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
pavel-stastny committed Jul 29, 2024
2 parents c183a57 + 7163bab commit 684d95b
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,18 @@
*/
public class HttpAsyncClientProvider implements Provider<CloseableHttpAsyncClient> {

static final int MAX_CONNECTIONS = 50;

@Override
public CloseableHttpAsyncClient get() {
int httptimeout = new Integer(KConfiguration.getInstance().getProperty("http.timeout", "10000"));
int httpConnections = new Integer(KConfiguration.getInstance().getProperty("http.connections", "50"));

RequestConfig requestConfig = RequestConfig.custom()
.setSocketTimeout(httptimeout)
.setConnectTimeout(httptimeout).build();
CloseableHttpAsyncClient httpclient = HttpAsyncClients.custom()
.setDefaultRequestConfig(requestConfig)
.setMaxConnPerRoute(MAX_CONNECTIONS)
.setMaxConnTotal(MAX_CONNECTIONS)
.setMaxConnPerRoute(httpConnections)
.setMaxConnTotal(httpConnections)
.build();

return httpclient;
Expand Down

0 comments on commit 684d95b

Please sign in to comment.