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 15d2217553954f08b1ce889f7d7f4cf3e8ac9fec
Author: Claus Ibsen <claus.ib...@gmail.com>
AuthorDate: Sun Feb 28 10:24:56 2021 +0100

    camel-core - Use class instead of lambda as it makes profiling/debugging 
easier instead of lambda anonymous classes in hotspots in the routing engine.
---
 .../errorhandler/RedeliveryErrorHandler.java       | 31 +++++++++++++++-------
 1 file changed, 22 insertions(+), 9 deletions(-)

diff --git 
a/core/camel-core-processor/src/main/java/org/apache/camel/processor/errorhandler/RedeliveryErrorHandler.java
 
b/core/camel-core-processor/src/main/java/org/apache/camel/processor/errorhandler/RedeliveryErrorHandler.java
index f8956e6..d557bb7 100644
--- 
a/core/camel-core-processor/src/main/java/org/apache/camel/processor/errorhandler/RedeliveryErrorHandler.java
+++ 
b/core/camel-core-processor/src/main/java/org/apache/camel/processor/errorhandler/RedeliveryErrorHandler.java
@@ -342,12 +342,33 @@ public abstract class RedeliveryErrorHandler extends 
ErrorHandlerSupport
         return null;
     }
 
+    private final class SimpleDoneTask implements AsyncCallback {
+
+        private final SimpleTask task;
+
+        private SimpleDoneTask(SimpleTask task) {
+            this.task = task;
+        }
+
+        @Override
+        public void done(boolean doneSync) {
+            // only continue with callback if we are done
+            if (isDone(task.exchange)) {
+                reactiveExecutor.schedule(task.callback);
+            } else {
+                // error occurred so loop back around and call ourselves
+                reactiveExecutor.schedule(task);
+            }
+        }
+    }
+
     /**
      * Simple task to perform calling the processor with no redelivery support
      */
     protected class SimpleTask implements Runnable {
         private final ExtendedExchange exchange;
         private final AsyncCallback callback;
+        private final SimpleDoneTask doneTask = new SimpleDoneTask(this);
 
         public SimpleTask(Exchange exchange, AsyncCallback callback) {
             this.exchange = (ExtendedExchange) exchange;
@@ -392,15 +413,7 @@ public abstract class RedeliveryErrorHandler extends 
ErrorHandlerSupport
                 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);
-                    }
-                });
+                outputAsync.process(exchange, doneTask);
             }
         }
 

Reply via email to