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 f0316627b77 CAMEL-19319: fix a type check cache miss on the UnitOfWorkHelper f0316627b77 is described below commit f0316627b77e5a0c6b67fb76040739a62e51a1da Author: Otavio Rodolfo Piske <angusyo...@gmail.com> AuthorDate: Thu May 4 11:08:34 2023 +0200 CAMEL-19319: fix a type check cache miss on the UnitOfWorkHelper Only the MDCUnitOfWork class implements the Service interface, so move the clear() call to the done method and avoid the type check --- .../src/main/java/org/apache/camel/impl/engine/MDCUnitOfWork.java | 6 ++++++ .../src/main/java/org/apache/camel/support/UnitOfWorkHelper.java | 5 ----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/MDCUnitOfWork.java b/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/MDCUnitOfWork.java index 3cf1a52b289..e7c6c748849 100644 --- a/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/MDCUnitOfWork.java +++ b/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/MDCUnitOfWork.java @@ -211,6 +211,12 @@ public class MDCUnitOfWork extends DefaultUnitOfWork implements Service { } } + @Override + public void done(Exchange exchange) { + super.done(exchange); + clear(); + } + @Override protected void onDone() { super.onDone(); diff --git a/core/camel-support/src/main/java/org/apache/camel/support/UnitOfWorkHelper.java b/core/camel-support/src/main/java/org/apache/camel/support/UnitOfWorkHelper.java index 5ef53488a89..38bca852d1a 100644 --- a/core/camel-support/src/main/java/org/apache/camel/support/UnitOfWorkHelper.java +++ b/core/camel-support/src/main/java/org/apache/camel/support/UnitOfWorkHelper.java @@ -22,11 +22,9 @@ import java.util.List; import org.apache.camel.Exchange; import org.apache.camel.Route; -import org.apache.camel.Service; import org.apache.camel.spi.Synchronization; import org.apache.camel.spi.SynchronizationRouteAware; import org.apache.camel.spi.UnitOfWork; -import org.apache.camel.support.service.ServiceHelper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -53,9 +51,6 @@ public final class UnitOfWorkHelper { // unit of work is done try { uow.done(exchange); - if (uow instanceof Service) { - ServiceHelper.stopService(uow); - } } catch (Throwable e) { LOG.warn("Exception occurred during done UnitOfWork for Exchange: {}. This exception will be ignored.", exchange, e);