[camel] branch master updated (01a7ffa -> dd972bf)

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[camel] branch master updated (01a7ffa -> dd972bf)

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

davsclaus pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git.


    from 01a7ffa  Upgrade Netty to version 4.1.45.Final
     new c881a84  CAMEL-14354: camel-core - Optimize
     new dd972bf  CAMEL-14354: camel-core - Optimize

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../camel/processor/CamelInternalProcessor.java      | 20 +++++++++++++-------
 .../java/org/apache/camel/support/ObjectHelper.java  |  4 +++-
 2 files changed, 16 insertions(+), 8 deletions(-)

Reply | Threaded
Open this post in threaded view
|

[camel] 01/02: CAMEL-14354: camel-core - Optimize

davsclaus-2
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

commit c881a849e9dd80cc23046517fb2ff151a8bfaa92
Author: Claus Ibsen <[hidden email]>
AuthorDate: Mon Jan 13 20:30:48 2020 +0100

    CAMEL-14354: camel-core - Optimize
---
 .../src/main/java/org/apache/camel/support/ObjectHelper.java          | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/core/camel-support/src/main/java/org/apache/camel/support/ObjectHelper.java b/core/camel-support/src/main/java/org/apache/camel/support/ObjectHelper.java
index bae4ac5..b9d79dd 100644
--- a/core/camel-support/src/main/java/org/apache/camel/support/ObjectHelper.java
+++ b/core/camel-support/src/main/java/org/apache/camel/support/ObjectHelper.java
@@ -202,7 +202,9 @@ public final class ObjectHelper {
      */
     public static Object invokeMethodSafe(Method method, Object instance, Object... parameters) throws InvocationTargetException, IllegalAccessException {
         Object answer;
-        method.setAccessible(true);
+        if (!method.isAccessible()) {
+            method.setAccessible(true);
+        }
         if (parameters != null) {
             answer = method.invoke(instance, parameters);
         } else {

Reply | Threaded
Open this post in threaded view
|

[camel] 02/02: CAMEL-14354: camel-core - Optimize

davsclaus-2
In reply to this post by davsclaus-2
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

commit dd972bfddf080ae30ba1634949350e8d92364586
Author: Claus Ibsen <[hidden email]>
AuthorDate: Mon Jan 13 21:10:46 2020 +0100

    CAMEL-14354: camel-core - Optimize
---
 .../camel/processor/CamelInternalProcessor.java      | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)

diff --git a/core/camel-base/src/main/java/org/apache/camel/processor/CamelInternalProcessor.java b/core/camel-base/src/main/java/org/apache/camel/processor/CamelInternalProcessor.java
index a685085..f005d68 100644
--- a/core/camel-base/src/main/java/org/apache/camel/processor/CamelInternalProcessor.java
+++ b/core/camel-base/src/main/java/org/apache/camel/processor/CamelInternalProcessor.java
@@ -50,6 +50,7 @@ import org.apache.camel.spi.Synchronization;
 import org.apache.camel.spi.Tracer;
 import org.apache.camel.spi.Transformer;
 import org.apache.camel.spi.UnitOfWork;
+import org.apache.camel.spi.UnitOfWorkFactory;
 import org.apache.camel.support.CamelContextHelper;
 import org.apache.camel.support.MessageHelper;
 import org.apache.camel.support.OrderedComparator;
@@ -544,11 +545,13 @@ public class CamelInternalProcessor extends DelegateAsyncProcessor {
 
         private final RouteContext routeContext;
         private String routeId;
+        private UnitOfWorkFactory uowFactory;
 
         public UnitOfWorkProcessorAdvice(RouteContext routeContext) {
             this.routeContext = routeContext;
             if (routeContext != null) {
                 this.routeId = routeContext.getRouteId();
+                this.uowFactory = routeContext.getCamelContext().adapt(ExtendedCamelContext.class).getUnitOfWorkFactory();
             }
         }
 
@@ -601,7 +604,11 @@ public class CamelInternalProcessor extends DelegateAsyncProcessor {
         }
 
         protected UnitOfWork createUnitOfWork(Exchange exchange) {
-            return exchange.getContext().adapt(ExtendedCamelContext.class).getUnitOfWorkFactory().createUnitOfWork(exchange);
+            if (uowFactory != null) {
+                return uowFactory.createUnitOfWork(exchange);
+            } else {
+                return exchange.getContext().adapt(ExtendedCamelContext.class).getUnitOfWorkFactory().createUnitOfWork(exchange);
+            }
         }
 
     }
@@ -644,12 +651,6 @@ public class CamelInternalProcessor extends DelegateAsyncProcessor {
 
         @Override
         public MessageHistory before(Exchange exchange) throws Exception {
-            List<MessageHistory> list = exchange.getProperty(Exchange.MESSAGE_HISTORY, List.class);
-            if (list == null) {
-                list = new LinkedList<>();
-                exchange.setProperty(Exchange.MESSAGE_HISTORY, list);
-            }
-
             // we may be routing outside a route in an onException or interceptor and if so then grab
             // route id from the exchange UoW state
             String targetRouteId = this.routeId;
@@ -662,6 +663,11 @@ public class CamelInternalProcessor extends DelegateAsyncProcessor {
 
             MessageHistory history = factory.newMessageHistory(targetRouteId, definition, System.currentTimeMillis(), exchange);
             if (history != null) {
+                List<MessageHistory> list = exchange.getProperty(Exchange.MESSAGE_HISTORY, List.class);
+                if (list == null) {
+                    list = new LinkedList<>();
+                    exchange.setProperty(Exchange.MESSAGE_HISTORY, list);
+                }
                 list.add(history);
             }
             return history;