use of org.eclipse.jetty.unixsocket.client.HttpClientTransportOverUnixSockets in project Singularity by HubSpot.
the class SingularityExecutorModule method provideDownloadFetcher.
@Provides
@Singleton
public LocalDownloadServiceFetcher provideDownloadFetcher(SingularityS3Configuration s3Configuration, SingularityExecutorConfiguration executorConfiguration, ObjectMapper objectMapper) {
if (s3Configuration.getLocalDownloadSocket().isPresent()) {
HttpClient httpClient = new HttpClient(new HttpClientTransportOverUnixSockets(s3Configuration.getLocalDownloadSocket().get()), null);
return new UnixLocalDownloadServiceFetcher(httpClient, objectMapper, executorConfiguration, s3Configuration);
} else {
AsyncHttpClientConfig.Builder configBldr = new AsyncHttpClientConfig.Builder();
configBldr.setRequestTimeout((int) executorConfiguration.getLocalDownloadServiceTimeoutMillis());
configBldr.setPooledConnectionIdleTimeout((int) executorConfiguration.getLocalDownloadServiceTimeoutMillis());
configBldr.addRequestFilter(new ThrottleRequestFilter(executorConfiguration.getLocalDownloadServiceMaxConnections()));
return new HttpLocalDownloadServiceFetcher(new AsyncHttpClient(configBldr.build()), objectMapper, executorConfiguration, s3Configuration);
}
}
Aggregations