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

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

commit 51831a857aacc340dd9e3d083fb70a9c85625b52
Author: Amos Feng <zf...@redhat.com>
AuthorDate: Sun Jun 28 17:14:10 2020 +0800

    CAMEL-15251: camel-cdi fix the mandatory and never transaction policy 
(#3954)
---
 .../apache/camel/cdi/transaction/MandatoryJtaTransactionPolicy.java    | 3 ++-
 .../org/apache/camel/cdi/transaction/NeverJtaTransactionPolicy.java    | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git 
a/components/camel-cdi/src/main/java/org/apache/camel/cdi/transaction/MandatoryJtaTransactionPolicy.java
 
b/components/camel-cdi/src/main/java/org/apache/camel/cdi/transaction/MandatoryJtaTransactionPolicy.java
index 2a95fbf..d6af7fa 100644
--- 
a/components/camel-cdi/src/main/java/org/apache/camel/cdi/transaction/MandatoryJtaTransactionPolicy.java
+++ 
b/components/camel-cdi/src/main/java/org/apache/camel/cdi/transaction/MandatoryJtaTransactionPolicy.java
@@ -22,10 +22,11 @@ import javax.inject.Named;
 public class MandatoryJtaTransactionPolicy extends 
TransactionalJtaTransactionPolicy {
 
     @Override
-    public void run(final Runnable runnable) throws Exception {
+    public void run(final Runnable runnable) throws Throwable {
         if (!hasActiveTransaction()) {
             throw new IllegalStateException(
                     "Policy 'PROPAGATION_MANDATORY' is configured but no 
active transaction was found!");
         }
+        runWithTransaction(runnable, false);
     }
 }
diff --git 
a/components/camel-cdi/src/main/java/org/apache/camel/cdi/transaction/NeverJtaTransactionPolicy.java
 
b/components/camel-cdi/src/main/java/org/apache/camel/cdi/transaction/NeverJtaTransactionPolicy.java
index 09b8d9f..0f9fa6c 100644
--- 
a/components/camel-cdi/src/main/java/org/apache/camel/cdi/transaction/NeverJtaTransactionPolicy.java
+++ 
b/components/camel-cdi/src/main/java/org/apache/camel/cdi/transaction/NeverJtaTransactionPolicy.java
@@ -22,10 +22,11 @@ import javax.inject.Named;
 public class NeverJtaTransactionPolicy extends 
TransactionalJtaTransactionPolicy {
 
     @Override
-    public void run(final Runnable runnable) throws Exception {
+    public void run(final Runnable runnable) throws Throwable {
         if (hasActiveTransaction()) {
             throw new IllegalStateException(
                     "Policy 'PROPAGATION_NEVER' is configured but an active 
transaction was found!");
         }
+        runnable.run();
     }
 }

Reply via email to