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/11/04 08:39:11 UTC

[camel] branch master updated: CAMEL-15802: camel-core - Optimize

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 1f6716c  CAMEL-15802: camel-core - Optimize
1f6716c is described below

commit 1f6716c0c22906743e6f4bb09647ccc7b2df32f4
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Wed Nov 4 09:38:41 2020 +0100

    CAMEL-15802: camel-core - Optimize
---
 core/camel-api/src/main/java/org/apache/camel/Route.java      | 11 ++++++-----
 .../main/java/org/apache/camel/impl/engine/DefaultRoute.java  | 11 -----------
 .../java/org/apache/camel/processor/MulticastProcessor.java   |  4 +---
 3 files changed, 7 insertions(+), 19 deletions(-)

diff --git a/core/camel-api/src/main/java/org/apache/camel/Route.java b/core/camel-api/src/main/java/org/apache/camel/Route.java
index b40bbd3..9f14a1c 100644
--- a/core/camel-api/src/main/java/org/apache/camel/Route.java
+++ b/core/camel-api/src/main/java/org/apache/camel/Route.java
@@ -291,24 +291,25 @@ public interface Route extends RuntimeConfiguration {
      */
     List<RoutePolicy> getRoutePolicyList();
 
+    // called at completion time
     void setErrorHandlerFactory(ErrorHandlerFactory errorHandlerFactory);
 
+    // called at runtime
     ErrorHandlerFactory getErrorHandlerFactory();
 
-    Processor createErrorHandler(Processor processor) throws Exception;
-
-    Collection<Processor> getOnCompletions();
-
     // called at runtime
-    Processor getOnCompletion(String onCompletionId);
+    Collection<Processor> getOnCompletions();
 
     // called at completion time
     void setOnCompletion(String onCompletionId, Processor processor);
 
+    // called at runtime
     Collection<Processor> getOnExceptions();
 
+    // called at runtime
     Processor getOnException(String onExceptionId);
 
+    // called at completion time
     void setOnException(String onExceptionId, Processor processor);
 
     /**
diff --git a/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/DefaultRoute.java b/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/DefaultRoute.java
index bc66a03..d07ac95 100644
--- a/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/DefaultRoute.java
+++ b/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/DefaultRoute.java
@@ -31,7 +31,6 @@ import org.apache.camel.CamelContext;
 import org.apache.camel.Consumer;
 import org.apache.camel.Endpoint;
 import org.apache.camel.ErrorHandlerFactory;
-import org.apache.camel.ExtendedCamelContext;
 import org.apache.camel.NamedNode;
 import org.apache.camel.Navigate;
 import org.apache.camel.Processor;
@@ -107,11 +106,6 @@ public class DefaultRoute extends ServiceSupport implements Route {
     }
 
     @Override
-    public Processor createErrorHandler(Processor processor) throws Exception {
-        return camelContext.adapt(ExtendedCamelContext.class).createErrorHandler(this, processor);
-    }
-
-    @Override
     public String getId() {
         return routeId;
     }
@@ -499,11 +493,6 @@ public class DefaultRoute extends ServiceSupport implements Route {
     }
 
     @Override
-    public Processor getOnCompletion(String onCompletionId) {
-        return onCompletions.get(onCompletionId);
-    }
-
-    @Override
     public void setOnCompletion(String onCompletionId, Processor processor) {
         onCompletions.put(onCompletionId, processor);
     }
diff --git a/core/camel-core-processor/src/main/java/org/apache/camel/processor/MulticastProcessor.java b/core/camel-core-processor/src/main/java/org/apache/camel/processor/MulticastProcessor.java
index da1fbe1..a38c399 100644
--- a/core/camel-core-processor/src/main/java/org/apache/camel/processor/MulticastProcessor.java
+++ b/core/camel-core-processor/src/main/java/org/apache/camel/processor/MulticastProcessor.java
@@ -758,10 +758,8 @@ public class MulticastProcessor extends AsyncProcessorSupport implements Navigat
             }
 
             LOG.trace("Creating error handler for: {}", processor);
-            // create error handler (create error handler directly to keep it light weight,
-            // instead of using ProcessorReifier.wrapInErrorHandler)
             try {
-                processor = route.createErrorHandler(processor);
+                processor = camelContext.adapt(ExtendedCamelContext.class).createErrorHandler(route, processor);
 
                 // and wrap in unit of work processor so the copy exchange also can run under UoW
                 answer = createUnitOfWorkProcessor(route, processor, exchange);