[ 
https://issues.apache.org/jira/browse/CAMEL-12740?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16586028#comment-16586028
 ] 

ASF GitHub Bot commented on CAMEL-12740:
----------------------------------------

ninckblokje opened a new pull request #2487: CAMEL-12740: 
HttpAsyncClientBuilder is now used when no ClientBuilder…
URL: https://github.com/apache/camel/pull/2487
 
 
   I have changed the Olingo2 and Olingo4 components do use the created 
HttpAsyncClientBuilder when no builder is specified. In the previous scenario 
the created HttpAsyncClientBuilder was ignored.
   
   See CAMEL-12740

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Olingo4Component creates and ignores HttpAsyncClientBuilder
> -----------------------------------------------------------
>
>                 Key: CAMEL-12740
>                 URL: https://issues.apache.org/jira/browse/CAMEL-12740
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-olingo4
>    Affects Versions: 2.22.0
>            Reporter: Jeroen NB
>            Priority: Major
>             Fix For: 2.22.1, 2.23.0
>
>
> The Olingo4Component will create an instance of HttpAsyncClientBuilder is the 
> provided Olingo4Configuration does not contain one. The new instance of 
> HttpAsyncClientBuilder will be configured with timeout settings, proxy and 
> SSL, but will never be used.
> Extract from Olingo4Component.createOlingo4App:
> {code:java}
> Object clientBuilder = configuration.getHttpAsyncClientBuilder();
> if (clientBuilder == null) {
>     HttpAsyncClientBuilder asyncClientBuilder = 
> HttpAsyncClientBuilder.create();
>     Builder requestConfigBuilder = RequestConfig.custom();
>     requestConfigBuilder.setConnectTimeout(configuration.getConnectTimeout());
>     requestConfigBuilder.setSocketTimeout(configuration.getSocketTimeout());
>     HttpHost proxy = configuration.getProxy();
>     if (proxy != null) {
>         requestConfigBuilder.setProxy(proxy);
>     }
>     asyncClientBuilder.setDefaultRequestConfig(requestConfigBuilder.build());
>     SSLContextParameters sslContextParameters = 
> configuration.getSslContextParameters();
>     if (sslContextParameters == null) {
>         sslContextParameters = this.retrieveGlobalSslContextParameters();
>     }
>     if (sslContextParameters == null) {
>         sslContextParameters = new SSLContextParameters();
>     }
>     try {
>         
> asyncClientBuilder.setSSLContext(sslContextParameters.createSSLContext(this.getCamelContext()));
>     } catch (GeneralSecurityException var8) {
>         throw ObjectHelper.wrapRuntimeCamelException(var8);
>     } catch (IOException var9) {
>         throw ObjectHelper.wrapRuntimeCamelException(var9);
>     }
> }
> Olingo4AppImpl olingo4App;
> if (clientBuilder != null && !(clientBuilder instanceof 
> HttpAsyncClientBuilder)) {
>     olingo4App = new Olingo4AppImpl(configuration.getServiceUri(), 
> (HttpClientBuilder)clientBuilder);
> } else {
>     olingo4App = new Olingo4AppImpl(configuration.getServiceUri(), 
> (HttpAsyncClientBuilder)clientBuilder);
> }
> {code}
> The class Olingo4AppImpl gets a null clientBuilder reference and then 
> instantiates its own:
> {code:java}
> public Olingo4AppImpl(String serviceUri, HttpAsyncClientBuilder builder) {
>     this.odataClient = ODataClientFactory.getClient();
>     this.odataReader = this.odataClient.getReader();
>     this.odataWriter = this.odataClient.getWriter();
>     this.setServiceUri(serviceUri);
>     CloseableHttpAsyncClient asyncClient;
>     if (builder == null) {
>         asyncClient = HttpAsyncClients.createDefault();
>     } else {
>         asyncClient = builder.build();
>     }
>     asyncClient.start();
>     this.client = asyncClient;
>     this.contentType = DEFAULT_CONTENT_TYPE;
> }
> {code}
> Because of this, none of the Olingo4Configuration settings are used and for 
> example connect and socket timeout defaults to -1.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to