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:26 UTC

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

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);
+                    }
+                });
             }
         }