You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2020/06/09 14:04:37 UTC

[camel] branch master updated: CAMEL-15164: camel-lra should close the rest client when stopping.

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 70065d1  CAMEL-15164: camel-lra should close the rest client when stopping.
70065d1 is described below

commit 70065d1fc311cc5c3e558182506ef63699d36999
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Tue Jun 9 16:03:17 2020 +0200

    CAMEL-15164: camel-lra should close the rest client when stopping.
---
 .../src/main/java/org/apache/camel/service/lra/LRAClient.java  | 10 +++++++++-
 .../main/java/org/apache/camel/service/lra/LRASagaService.java |  1 +
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/components/camel-lra/src/main/java/org/apache/camel/service/lra/LRAClient.java b/components/camel-lra/src/main/java/org/apache/camel/service/lra/LRAClient.java
index 2bc729c..cbcaf84 100644
--- a/components/camel-lra/src/main/java/org/apache/camel/service/lra/LRAClient.java
+++ b/components/camel-lra/src/main/java/org/apache/camel/service/lra/LRAClient.java
@@ -16,6 +16,8 @@
  */
 package org.apache.camel.service.lra;
 
+import java.io.Closeable;
+import java.io.IOException;
 import java.net.URL;
 import java.util.concurrent.CompletableFuture;
 import java.util.function.Function;
@@ -39,7 +41,7 @@ import static org.apache.camel.service.lra.LRAConstants.HEADER_TIME_LIMIT;
 import static org.apache.camel.service.lra.LRAConstants.PARTICIPANT_PATH_COMPENSATE;
 import static org.apache.camel.service.lra.LRAConstants.PARTICIPANT_PATH_COMPLETE;
 
-public class LRAClient {
+public class LRAClient implements Closeable {
 
 
     private final LRASagaService sagaService;
@@ -187,4 +189,10 @@ public class LRAClient {
         }
     }
 
+    @Override
+    public void close() throws IOException {
+        if (client != null) {
+            client.close();
+        }
+    }
 }
diff --git a/components/camel-lra/src/main/java/org/apache/camel/service/lra/LRASagaService.java b/components/camel-lra/src/main/java/org/apache/camel/service/lra/LRASagaService.java
index 12a7405..e5f47ab 100644
--- a/components/camel-lra/src/main/java/org/apache/camel/service/lra/LRASagaService.java
+++ b/components/camel-lra/src/main/java/org/apache/camel/service/lra/LRASagaService.java
@@ -99,6 +99,7 @@ public class LRASagaService extends ServiceSupport implements CamelSagaService {
             this.executorService = null;
         }
         if (this.client != null) {
+            this.client.close();
             this.client = null;
         }
     }