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

jamesnetherton 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 c0ba9a68b8d Upgrade SmallRye Fault Tolerance to 6.3.0
c0ba9a68b8d is described below

commit c0ba9a68b8d5a92585e9d5d8ba0521f6d1def32c
Author: James Netherton <jamesnether...@gmail.com>
AuthorDate: Fri Apr 12 10:51:29 2024 +0100

    Upgrade SmallRye Fault Tolerance to 6.3.0
---
 .../faulttolerance/FaultToleranceProcessor.java             | 13 ++++++++-----
 parent/pom.xml                                              |  2 +-
 2 files changed, 9 insertions(+), 6 deletions(-)

diff --git 
a/components/camel-microprofile/camel-microprofile-fault-tolerance/src/main/java/org/apache/camel/component/microprofile/faulttolerance/FaultToleranceProcessor.java
 
b/components/camel-microprofile/camel-microprofile-fault-tolerance/src/main/java/org/apache/camel/component/microprofile/faulttolerance/FaultToleranceProcessor.java
index b0f3948ba78..7f6e6003374 100644
--- 
a/components/camel-microprofile/camel-microprofile-fault-tolerance/src/main/java/org/apache/camel/component/microprofile/faulttolerance/FaultToleranceProcessor.java
+++ 
b/components/camel-microprofile/camel-microprofile-fault-tolerance/src/main/java/org/apache/camel/component/microprofile/faulttolerance/FaultToleranceProcessor.java
@@ -28,9 +28,7 @@ import 
io.smallrye.faulttolerance.core.bulkhead.FutureThreadPoolBulkhead;
 import io.smallrye.faulttolerance.core.circuit.breaker.CircuitBreaker;
 import io.smallrye.faulttolerance.core.fallback.Fallback;
 import io.smallrye.faulttolerance.core.stopwatch.SystemStopwatch;
-import io.smallrye.faulttolerance.core.timeout.ScheduledExecutorTimeoutWatcher;
 import io.smallrye.faulttolerance.core.timeout.Timeout;
-import io.smallrye.faulttolerance.core.timeout.TimeoutWatcher;
 import io.smallrye.faulttolerance.core.timer.ThreadTimer;
 import io.smallrye.faulttolerance.core.util.ExceptionDecision;
 import org.apache.camel.AsyncCallback;
@@ -90,6 +88,7 @@ public class FaultToleranceProcessor extends 
AsyncProcessorSupport
     private ProcessorExchangeFactory processorExchangeFactory;
     private PooledExchangeTaskFactory taskFactory;
     private PooledExchangeTaskFactory fallbackTaskFactory;
+    private ThreadTimer timer;
 
     public FaultToleranceProcessor(FaultToleranceConfiguration config, 
Processor processor,
                                    Processor fallbackProcessor) {
@@ -263,8 +262,7 @@ public class FaultToleranceProcessor extends 
AsyncProcessorSupport
             }
             // 2. timeout
             if (config.isTimeoutEnabled()) {
-                TimeoutWatcher watcher = new 
ScheduledExecutorTimeoutWatcher(scheduledExecutorService);
-                target = new Timeout<>(target, "timeout", 
config.getTimeoutDuration(), watcher);
+                target = new Timeout<>(target, "timeout", 
config.getTimeoutDuration(), timer);
             }
             // 3. fallback
             if (fallbackProcessor != null) {
@@ -355,10 +353,11 @@ public class FaultToleranceProcessor extends 
AsyncProcessorSupport
                     = 
getCamelContext().getExecutorServiceManager().newCachedThreadPool(this, 
"CircuitBreakerThreadTimer");
             shutdownThreadTimerExecutorService = true;
 
+            timer = ThreadTimer.create(threadTimerExecutorService);
             circuitBreaker = new CircuitBreaker<>(
                     invocation(), id, ExceptionDecision.ALWAYS_FAILURE, 
config.getDelay(), config.getRequestVolumeThreshold(),
                     config.getFailureRatio(),
-                    config.getSuccessThreshold(), SystemStopwatch.INSTANCE, 
new ThreadTimer(threadTimerExecutorService));
+                    config.getSuccessThreshold(), SystemStopwatch.INSTANCE, 
timer);
         }
 
         ServiceHelper.initService(processorExchangeFactory, taskFactory, 
fallbackTaskFactory, processor);
@@ -390,6 +389,10 @@ public class FaultToleranceProcessor extends 
AsyncProcessorSupport
             
getCamelContext().getExecutorServiceManager().shutdownNow(executorService);
             executorService = null;
         }
+        if (timer != null) {
+            timer.shutdown();
+            timer = null;
+        }
         if (shutdownThreadTimerExecutorService && threadTimerExecutorService 
!= null) {
             
getCamelContext().getExecutorServiceManager().shutdownNow(threadTimerExecutorService);
             threadTimerExecutorService = null;
diff --git a/parent/pom.xml b/parent/pom.xml
index 87e3a2380cd..5993d3be139 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -437,7 +437,7 @@
         <smack-version>4.3.5</smack-version>
         <smallrye-config-version>3.6.0</smallrye-config-version>
         <smallrye-health-version>4.1.0</smallrye-health-version>
-        
<smallrye-fault-tolerance-version>6.2.6</smallrye-fault-tolerance-version>
+        
<smallrye-fault-tolerance-version>6.3.0</smallrye-fault-tolerance-version>
         <smbj-version>0.13.0</smbj-version>
         <snakeyaml-version>2.2</snakeyaml-version>
         <snakeyaml-engine-version>2.7</snakeyaml-engine-version>

Reply via email to