You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by or...@apache.org on 2021/07/13 05:21:39 UTC

[camel] branch main updated: camel-http: fix possible concurrency issue (#5828)

This is an automated email from the ASF dual-hosted git repository.

orpiske pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/main by this push:
     new ace9f2e  camel-http: fix possible concurrency issue (#5828)
ace9f2e is described below

commit ace9f2e431b6bcbde0b1fd2d64d660475899e276
Author: Otavio Rodolfo Piske <or...@users.noreply.github.com>
AuthorDate: Tue Jul 13 07:21:06 2021 +0200

    camel-http: fix possible concurrency issue (#5828)
    
    Fix an unlikely but possible inconsistency when multiple threads are reading/writing the http client object instance. The missing lock on setHttpClient could lead to subtle bugs if multiple threads try to get/set the instance at the same time.
---
 .../src/main/java/org/apache/camel/component/http/HttpEndpoint.java     | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/components/camel-http/src/main/java/org/apache/camel/component/http/HttpEndpoint.java b/components/camel-http/src/main/java/org/apache/camel/component/http/HttpEndpoint.java
index 1df1a23..fdd282a 100644
--- a/components/camel-http/src/main/java/org/apache/camel/component/http/HttpEndpoint.java
+++ b/components/camel-http/src/main/java/org/apache/camel/component/http/HttpEndpoint.java
@@ -203,7 +203,7 @@ public class HttpEndpoint extends HttpCommonEndpoint {
     /**
      * Sets a custom HttpClient to be used by the producer
      */
-    public void setHttpClient(HttpClient httpClient) {
+    public synchronized void setHttpClient(HttpClient httpClient) {
         this.httpClient = httpClient;
     }