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 e2da037  CAMEL-14354: camel-core optimize
e2da037 is described below

commit e2da037e797d64e402bc6ca526d255ad112476f2
Author: Claus Ibsen <claus.ib...@gmail.com>
AuthorDate: Wed Jan 29 05:42:03 2020 +0100

    CAMEL-14354: camel-core optimize
---
 .../java/org/apache/camel/support/UnitOfWorkHelper.java   | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

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 7c03036..9fe7431 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
@@ -46,23 +46,26 @@ public final class UnitOfWorkHelper {
      * @param exchange the exchange (will unset the UoW on the exchange)
      */
     public static void doneUow(UnitOfWork uow, Exchange exchange) {
+        if (uow == null) {
+            return;
+        }
         // unit of work is done
         try {
-            if (uow != null) {
-                uow.done(exchange);
-            }
+            uow.done(exchange);
         } catch (Throwable e) {
             LOG.warn("Exception occurred during done UnitOfWork for Exchange: 
" + exchange
                     + ". This exception will be ignored.", e);
         }
+        // stop
         try {
-            if (uow != null) {
-                uow.stop();
-            }
+            uow.stop();
         } catch (Throwable e) {
             LOG.warn("Exception occurred during stopping UnitOfWork for 
Exchange: " + exchange
                     + ". This exception will be ignored.", e);
         }
+        // MUST clear and set uow to null on exchange after done
+        ExtendedExchange ee = (ExtendedExchange) exchange;
+        ee.setUnitOfWork(null);
     }
 
     public static void doneSynchronizations(Exchange exchange, 
List<Synchronization> synchronizations, Logger log) {

Reply via email to