use of com.facebook.airlift.http.client.HttpClientConfig in project presto by prestodb.
the class QueryStatsClientModuleProvider method getModule.
@Override
public Module getModule(Configuration configuration) {
return new PrivateModule() {
@Override
protected void configure() {
bind(ObjectMapper.class).toProvider(JsonObjectMapperProvider.class);
}
@Inject
@Provides
@Exposed
QueryStatsClient getQueryStatsClient(ObjectMapper objectMapper, @Named("databases.presto.server_address") String serverAddress) {
// @Singleton does not work due: https://github.com/prestodb/tempto/issues/94
if (httpQueryStatsClient == null) {
HttpClientConfig httpClientConfig = new HttpClientConfig();
httpClientConfig.setKeyStorePath(configuration.getString("databases.presto.https_keystore_path").orElse(null));
httpClientConfig.setKeyStorePassword(configuration.getString("databases.presto.https_keystore_password").orElse(null));
httpQueryStatsClient = new HttpQueryStatsClient(new JettyHttpClient(httpClientConfig), objectMapper, URI.create(serverAddress));
}
return httpQueryStatsClient;
}
};
}
Aggregations