You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2020/02/02 20:42:23 UTC

[camel] branch master updated (9a30a9c -> c337fe2)

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 9a30a9c  Upgrade Flink to version 1.9.2
     new f23f9fb  CAMEL-14354: camel-core - Optimize. Ah okay making the after task static was an expeirment as the classload would load it bootstrap vs load on first use.
     new 2a79dcc  CAMEL-14354: camel-core - Optimize to reduce object allocations for lambda in error handling (critical code path) which gains > 10%
     new c337fe2  Revert "CAMEL-14354: camel-core - Optimize to reduce object allocations for lambda in error handling (critical code path) which gains > 10%"

The 3 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:
 .../apache/camel/processor/CamelInternalProcessor.java   | 16 +++-------------
 1 file changed, 3 insertions(+), 13 deletions(-)


[camel] 01/03: CAMEL-14354: camel-core - Optimize. Ah okay making the after task static was an expeirment as the classload would load it bootstrap vs load on first use.

Posted by da...@apache.org.
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 f23f9fb4bcb636b9150758e5b58ff0643219371b
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Sun Feb 2 19:22:07 2020 +0100

    CAMEL-14354: camel-core - Optimize. Ah okay making the after task static was an expeirment as the classload would load it bootstrap vs load on first use.
---
 .../org/apache/camel/processor/CamelInternalProcessor.java    | 11 +++--------
 1 file changed, 3 insertions(+), 8 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 84c4ac0..e8f5a60 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
@@ -149,21 +149,16 @@ public class CamelInternalProcessor extends DelegateAsyncProcessor {
     /**
      * Callback task to process the advices after processing.
      */
-    private static final class AsyncAfterTask implements AsyncCallback {
+    private final class AsyncAfterTask implements AsyncCallback {
 
-        private final List<CamelInternalProcessorAdvice<?>> advices;
         private final Object[] states;
         private final Exchange exchange;
         private final AsyncCallback originalCallback;
-        private final ReactiveExecutor reactiveExecutor;
 
-        private AsyncAfterTask(List<CamelInternalProcessorAdvice<?>> advices, Object[] states,
-                               Exchange exchange, AsyncCallback originalCallback, ReactiveExecutor reactiveExecutor) {
-            this.advices = advices;
+        private AsyncAfterTask(Object[] states, Exchange exchange, AsyncCallback originalCallback) {
             this.states = states;
             this.exchange = exchange;
             this.originalCallback = originalCallback;
-            this.reactiveExecutor = reactiveExecutor;
         }
 
         @Override
@@ -256,7 +251,7 @@ public class CamelInternalProcessor extends DelegateAsyncProcessor {
         }
 
         // create internal callback which will execute the advices in reverse order when done
-        AsyncCallback callback = new AsyncAfterTask(advices, states, exchange, originalCallback, reactiveExecutor);
+        AsyncCallback callback = new AsyncAfterTask(states, exchange, originalCallback);
 
         if (exchange.isTransacted()) {
             // must be synchronized for transacted exchanges


[camel] 03/03: Revert "CAMEL-14354: camel-core - Optimize to reduce object allocations for lambda in error handling (critical code path) which gains > 10%"

Posted by da...@apache.org.
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 c337fe221c2c5fb1c4f3fabe745d2bba8c4f1a84
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Sun Feb 2 20:38:08 2020 +0100

    Revert "CAMEL-14354: camel-core - Optimize to reduce object allocations for lambda in error handling (critical code path) which gains > 10%"
    
    This reverts commit 2a79dccda2ce54ea5a5dff0b7a55e8d9430157bd.
---
 .../camel/processor/CamelInternalProcessor.java    |  5 ----
 .../errorhandler/RedeliveryErrorHandler.java       | 27 ++++++++++------------
 2 files changed, 12 insertions(+), 20 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 e8f5a60..1658281 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
@@ -163,11 +163,6 @@ public class CamelInternalProcessor extends DelegateAsyncProcessor {
 
         @Override
         public void done(boolean doneSync) {
-            // noop as we override run method
-        }
-
-        @Override
-        public void run() {
             try {
                 for (int i = advices.size() - 1, j = states.length - 1; i >= 0; i--) {
                     CamelInternalProcessorAdvice task = advices.get(i);
diff --git a/core/camel-base/src/main/java/org/apache/camel/processor/errorhandler/RedeliveryErrorHandler.java b/core/camel-base/src/main/java/org/apache/camel/processor/errorhandler/RedeliveryErrorHandler.java
index ea0a025..bd1bf11 100644
--- a/core/camel-base/src/main/java/org/apache/camel/processor/errorhandler/RedeliveryErrorHandler.java
+++ b/core/camel-base/src/main/java/org/apache/camel/processor/errorhandler/RedeliveryErrorHandler.java
@@ -346,7 +346,7 @@ public abstract class RedeliveryErrorHandler extends ErrorHandlerSupport impleme
     /**
      * Simple task to perform calling the processor with no redelivery support
      */
-    protected class SimpleTask implements Runnable, AsyncCallback {
+    protected class SimpleTask implements Runnable {
         private final ExtendedExchange exchange;
         private final AsyncCallback callback;
 
@@ -360,17 +360,6 @@ public abstract class RedeliveryErrorHandler extends ErrorHandlerSupport impleme
             return "SimpleTask";
         }
 
-        @Override
-        public void done(boolean doneSync) {
-            // only continue routing with the original callback
-            if (isDone(exchange)) {
-                reactiveExecutor.schedule(callback);
-            } else {
-                // error occurred so loop back around and call ourselves
-                reactiveExecutor.schedule(this);
-            }
-        }
-
         /**
          * Processing logic.
          */
@@ -392,11 +381,19 @@ public abstract class RedeliveryErrorHandler extends ErrorHandlerSupport impleme
                 onExceptionOccurred();
                 prepareExchangeAfterFailure(exchange);
 
-                // we do not support redelivery so continue routing with the original callback
+                // we do not support redelivery so continue callback
                 reactiveExecutor.schedule(callback);
             } else {
-                // optimize to call done on ourselves
-                outputAsync.process(exchange, this);
+                // Simple delivery
+                outputAsync.process(exchange, doneSync -> {
+                    // only continue with callback if we are done
+                    if (isDone(exchange)) {
+                        reactiveExecutor.schedule(callback);
+                    } else {
+                        // error occurred so loop back around and call ourselves
+                        reactiveExecutor.schedule(this);
+                    }
+                });
             }
         }
 


[camel] 02/03: CAMEL-14354: camel-core - Optimize to reduce object allocations for lambda in error handling (critical code path) which gains > 10%

Posted by da...@apache.org.
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 2a79dccda2ce54ea5a5dff0b7a55e8d9430157bd
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Sun Feb 2 20:00:09 2020 +0100

    CAMEL-14354: camel-core - Optimize to reduce object allocations for lambda in error handling (critical code path) which gains > 10%
---
 .../errorhandler/RedeliveryErrorHandler.java       | 27 ++++++++++++----------
 1 file changed, 15 insertions(+), 12 deletions(-)

diff --git a/core/camel-base/src/main/java/org/apache/camel/processor/errorhandler/RedeliveryErrorHandler.java b/core/camel-base/src/main/java/org/apache/camel/processor/errorhandler/RedeliveryErrorHandler.java
index bd1bf11..ea0a025 100644
--- a/core/camel-base/src/main/java/org/apache/camel/processor/errorhandler/RedeliveryErrorHandler.java
+++ b/core/camel-base/src/main/java/org/apache/camel/processor/errorhandler/RedeliveryErrorHandler.java
@@ -346,7 +346,7 @@ public abstract class RedeliveryErrorHandler extends ErrorHandlerSupport impleme
     /**
      * Simple task to perform calling the processor with no redelivery support
      */
-    protected class SimpleTask implements Runnable {
+    protected class SimpleTask implements Runnable, AsyncCallback {
         private final ExtendedExchange exchange;
         private final AsyncCallback callback;
 
@@ -360,6 +360,17 @@ public abstract class RedeliveryErrorHandler extends ErrorHandlerSupport impleme
             return "SimpleTask";
         }
 
+        @Override
+        public void done(boolean doneSync) {
+            // only continue routing with the original callback
+            if (isDone(exchange)) {
+                reactiveExecutor.schedule(callback);
+            } else {
+                // error occurred so loop back around and call ourselves
+                reactiveExecutor.schedule(this);
+            }
+        }
+
         /**
          * Processing logic.
          */
@@ -381,19 +392,11 @@ public abstract class RedeliveryErrorHandler extends ErrorHandlerSupport impleme
                 onExceptionOccurred();
                 prepareExchangeAfterFailure(exchange);
 
-                // we do not support redelivery so continue callback
+                // we do not support redelivery so continue routing with the original callback
                 reactiveExecutor.schedule(callback);
             } else {
-                // Simple delivery
-                outputAsync.process(exchange, doneSync -> {
-                    // only continue with callback if we are done
-                    if (isDone(exchange)) {
-                        reactiveExecutor.schedule(callback);
-                    } else {
-                        // error occurred so loop back around and call ourselves
-                        reactiveExecutor.schedule(this);
-                    }
-                });
+                // optimize to call done on ourselves
+                outputAsync.process(exchange, this);
             }
         }