You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ja...@apache.org on 2022/11/21 14:56:11 UTC
[camel] branch main updated: CAMEL-18668: Upgrade SmallRye Fault Tolerance to 5.6.0
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 c896a4992e1 CAMEL-18668: Upgrade SmallRye Fault Tolerance to 5.6.0
c896a4992e1 is described below
commit c896a4992e109547d87e9ac28fc5c78fd0e98c55
Author: James Netherton <ja...@gmail.com>
AuthorDate: Mon Nov 21 13:31:48 2022 +0000
CAMEL-18668: Upgrade SmallRye Fault Tolerance to 5.6.0
---
camel-dependencies/pom.xml | 2 +-
.../faulttolerance/FaultToleranceProcessor.java | 15 +++++++++++++--
parent/pom.xml | 2 +-
3 files changed, 15 insertions(+), 4 deletions(-)
diff --git a/camel-dependencies/pom.xml b/camel-dependencies/pom.xml
index 3ab8cdf9c39..ce3b4769680 100644
--- a/camel-dependencies/pom.xml
+++ b/camel-dependencies/pom.xml
@@ -496,7 +496,7 @@
<slf4j-version>1.7.36</slf4j-version>
<smack-version>4.3.5</smack-version>
<smallrye-config-version>2.12.0</smallrye-config-version>
- <smallrye-fault-tolerance-version>5.5.0</smallrye-fault-tolerance-version>
+ <smallrye-fault-tolerance-version>5.6.0</smallrye-fault-tolerance-version>
<smallrye-health-version>3.3.0</smallrye-health-version>
<smallrye-metrics-version>3.0.5</smallrye-metrics-version>
<snakeyaml-engine-version>2.3</snakeyaml-engine-version>
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 10112f11714..8ccaca4bab2 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
@@ -31,6 +31,7 @@ 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;
import org.apache.camel.CamelContext;
@@ -85,6 +86,8 @@ public class FaultToleranceProcessor extends AsyncProcessorSupport
private boolean shutdownScheduledExecutorService;
private ExecutorService executorService;
private boolean shutdownExecutorService;
+ private ExecutorService threadTimerExecutorService;
+ private boolean shutdownThreadTimerExecutorService;
private ProcessorExchangeFactory processorExchangeFactory;
private PooledExchangeTaskFactory taskFactory;
private PooledExchangeTaskFactory fallbackTaskFactory;
@@ -349,10 +352,14 @@ public class FaultToleranceProcessor extends AsyncProcessorSupport
protected void doInit() throws Exception {
ObjectHelper.notNull(camelContext, "CamelContext", this);
if (circuitBreaker == null) {
- circuitBreaker = new CircuitBreaker(
+ threadTimerExecutorService
+ = getCamelContext().getExecutorServiceManager().newCachedThreadPool(this, "CircuitBreakerThreadTimer");
+ shutdownThreadTimerExecutorService = true;
+
+ circuitBreaker = new CircuitBreaker<>(
invocation(), id, ExceptionDecision.ALWAYS_FAILURE, config.getDelay(), config.getRequestVolumeThreshold(),
config.getFailureRatio(),
- config.getSuccessThreshold(), new SystemStopwatch());
+ config.getSuccessThreshold(), SystemStopwatch.INSTANCE, new ThreadTimer(threadTimerExecutorService));
}
ServiceHelper.initService(processorExchangeFactory, taskFactory, fallbackTaskFactory, processor);
@@ -384,6 +391,10 @@ public class FaultToleranceProcessor extends AsyncProcessorSupport
getCamelContext().getExecutorServiceManager().shutdownNow(executorService);
executorService = null;
}
+ if (shutdownThreadTimerExecutorService && threadTimerExecutorService != null) {
+ getCamelContext().getExecutorServiceManager().shutdownNow(threadTimerExecutorService);
+ threadTimerExecutorService = null;
+ }
ServiceHelper.stopService(processorExchangeFactory, taskFactory, fallbackTaskFactory, processor);
}
diff --git a/parent/pom.xml b/parent/pom.xml
index 2ff2effde14..41fd272a129 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -485,7 +485,7 @@
<smallrye-config-version>2.12.0</smallrye-config-version>
<smallrye-metrics-version>3.0.5</smallrye-metrics-version>
<smallrye-health-version>3.3.0</smallrye-health-version>
- <smallrye-fault-tolerance-version>5.5.0</smallrye-fault-tolerance-version>
+ <smallrye-fault-tolerance-version>5.6.0</smallrye-fault-tolerance-version>
<snakeyaml-version>1.33</snakeyaml-version>
<snakeyaml-engine-version>2.3</snakeyaml-engine-version>
<snmp4j-version>2.6.3_1</snmp4j-version>