Skip to content

Commit

Permalink
fix checkstyle
Browse files Browse the repository at this point in the history
  • Loading branch information
moscicky committed Jun 20, 2023
1 parent 2279d99 commit 7580cd9
Showing 1 changed file with 13 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,19 @@ public HttpClientsFactory(
}

public HttpClient createClientForHttp1(String name, Http1ClientParameters http1ClientParameters) {
ExecutorService executor = executorFactory.getExecutorService(
name,
http1ClientParameters.getThreadPoolSize(),
http1ClientParameters.isThreadPoolMonitoringEnabled());
ClientConnector clientConnector = new ClientConnector();
sslContextFactoryProvider.provideSslContextFactory()
.ifPresent(clientConnector::setSslContextFactory);
HttpClientTransportOverHTTP transport = new HttpClientTransportOverHTTP(clientConnector);
HttpClient client = new HttpClient(transport);

ExecutorService executor = executorFactory.getExecutorService(
name,
http1ClientParameters.getThreadPoolSize(),
http1ClientParameters.isThreadPoolMonitoringEnabled());
client.setExecutor(executor);
client.setMaxConnectionsPerDestination(http1ClientParameters.getMaxConnectionsPerDestination());
client.setMaxRequestsQueuedPerDestination(http1ClientParameters.getMaxRequestsQueuedPerDestination());
client.setExecutor(executor);
client.setCookieStore(new HttpCookieStore.Empty());
client.setIdleTimeout(http1ClientParameters.getIdleTimeout().toMillis());
client.setFollowRedirects(http1ClientParameters.isFollowRedirectsEnabled());
Expand All @@ -43,22 +44,23 @@ public HttpClient createClientForHttp1(String name, Http1ClientParameters http1C
}

public HttpClient createClientForHttp2(String name, Http2ClientParameters http2ClientParameters) {
ExecutorService executor = executorFactory.getExecutorService(
name,
http2ClientParameters.getThreadPoolSize(),
http2ClientParameters.isThreadPoolMonitoringEnabled());

ClientConnector clientConnector = new ClientConnector();
sslContextFactoryProvider.provideSslContextFactory()
.ifPresentOrElse(clientConnector::setSslContextFactory,
() -> {
throw new IllegalStateException("Cannot create http/2 client due to lack of ssl context factory");
});
HTTP2Client http2Client = new HTTP2Client(clientConnector);

ExecutorService executor = executorFactory.getExecutorService(
name,
http2ClientParameters.getThreadPoolSize(),
http2ClientParameters.isThreadPoolMonitoringEnabled());
http2Client.setExecutor(executor);
HttpClientTransportOverHTTP2 transport = new HttpClientTransportOverHTTP2(http2Client);

HttpClientTransportOverHTTP2 transport = new HttpClientTransportOverHTTP2(http2Client);
HttpClient client = new HttpClient(transport);

client.setMaxRequestsQueuedPerDestination(http2ClientParameters.getMaxRequestsQueuedPerDestination());
client.setCookieStore(new HttpCookieStore.Empty());
client.setIdleTimeout(http2ClientParameters.getIdleTimeout().toMillis());
Expand Down

0 comments on commit 7580cd9

Please sign in to comment.