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/01/28 13:07:25 UTC

[camel] branch master updated (1bb6cea -> a9d34cf)

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 1bb6cea  Regen docs
     new 78005b3  CAMEL-14354: camel-core optimize
     new a9d34cf  Regen

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:
 components/camel-bindy/src/main/docs/bindy-dataformat.adoc |  2 +-
 .../src/main/java/org/apache/camel/ExtendedExchange.java   |  2 +-
 .../java/org/apache/camel/processor/PipelineHelper.java    | 14 ++++++--------
 .../aggregate/ShareUnitOfWorkAggregationStrategy.java      |  6 ++----
 .../processor/aggregate/UseLatestAggregationStrategy.java  |  7 +++----
 .../java/org/apache/camel/support/DefaultExchange.java     |  5 +++++
 .../main/java/org/apache/camel/support/ExchangeHelper.java | 12 ------------
 docs/components/modules/ROOT/pages/bindy-dataformat.adoc   |  2 +-
 8 files changed, 19 insertions(+), 31 deletions(-)


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

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 78005b3f7db87a7f1e3405ea1e72db95e5eefcd9
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Tue Jan 28 12:12:14 2020 +0100

    CAMEL-14354: camel-core optimize
---
 .../src/main/java/org/apache/camel/ExtendedExchange.java   |  2 +-
 .../java/org/apache/camel/processor/PipelineHelper.java    | 14 ++++++--------
 .../aggregate/ShareUnitOfWorkAggregationStrategy.java      |  6 ++----
 .../processor/aggregate/UseLatestAggregationStrategy.java  |  7 +++----
 .../java/org/apache/camel/support/DefaultExchange.java     |  5 +++++
 .../main/java/org/apache/camel/support/ExchangeHelper.java | 12 ------------
 6 files changed, 17 insertions(+), 29 deletions(-)

diff --git a/core/camel-api/src/main/java/org/apache/camel/ExtendedExchange.java b/core/camel-api/src/main/java/org/apache/camel/ExtendedExchange.java
index 02816c2..61184f4 100644
--- a/core/camel-api/src/main/java/org/apache/camel/ExtendedExchange.java
+++ b/core/camel-api/src/main/java/org/apache/camel/ExtendedExchange.java
@@ -128,7 +128,7 @@ public interface ExtendedExchange extends Exchange {
      */
     void setRedeliveryExhausted(boolean redeliveryExhausted);
 
-    // TODO: javadoc
+    boolean isErrorHandlerHandled();
 
     Boolean getErrorHandlerHandled();
 
diff --git a/core/camel-base/src/main/java/org/apache/camel/processor/PipelineHelper.java b/core/camel-base/src/main/java/org/apache/camel/processor/PipelineHelper.java
index 9b5dc5f..b55fe85 100644
--- a/core/camel-base/src/main/java/org/apache/camel/processor/PipelineHelper.java
+++ b/core/camel-base/src/main/java/org/apache/camel/processor/PipelineHelper.java
@@ -17,10 +17,9 @@
 package org.apache.camel.processor;
 
 import org.apache.camel.Exchange;
+import org.apache.camel.ExtendedExchange;
 import org.slf4j.Logger;
 
-import static org.apache.camel.support.ExchangeHelper.hasExceptionBeenHandledByErrorHandler;
-
 /**
  * Helper for processing {@link org.apache.camel.Exchange} in a
  * <a href="http://camel.apache.org/pipes-and-filters.html">pipeline</a>.
@@ -39,10 +38,9 @@ public final class PipelineHelper {
      * @return <tt>true</tt> to continue processing, <tt>false</tt> to break out, for example if an exception occurred.
      */
     public static boolean continueProcessing(Exchange exchange, String message, Logger log) {
-        // check for error if so we should break out
-        boolean exceptionHandled = hasExceptionBeenHandledByErrorHandler(exchange);
-        if (exceptionHandled || exchange.isFailed() || exchange.isRollbackOnly() || exchange.isRollbackOnlyLast()) {
-            // The Exchange.ERRORHANDLED_HANDLED property is only set if satisfactory handling was done
+        ExtendedExchange ee = (ExtendedExchange) exchange;
+        if (ee.isFailed() || ee.isRollbackOnly() || ee.isRollbackOnlyLast() || ee.isErrorHandlerHandled()) {
+            // The errorErrorHandler is only set if satisfactory handling was done
             // by the error handler. It's still an exception, the exchange still failed.
             if (log.isDebugEnabled()) {
                 StringBuilder sb = new StringBuilder();
@@ -53,7 +51,7 @@ public final class PipelineHelper {
                 if (exchange.getException() != null) {
                     sb.append(" Exception: ").append(exchange.getException());
                 }
-                if (exceptionHandled) {
+                if (ee.isErrorHandlerHandled()) {
                     sb.append(" Handled by the error handler.");
                 }
                 log.debug(sb.toString());
@@ -63,7 +61,7 @@ public final class PipelineHelper {
         }
 
         // check for stop
-        if (exchange.isRouteStop()) {
+        if (ee.isRouteStop()) {
             if (log.isDebugEnabled()) {
                 log.debug("ExchangeId: {} is marked to stop routing: {}", exchange.getExchangeId(), exchange);
             }
diff --git a/core/camel-base/src/main/java/org/apache/camel/processor/aggregate/ShareUnitOfWorkAggregationStrategy.java b/core/camel-base/src/main/java/org/apache/camel/processor/aggregate/ShareUnitOfWorkAggregationStrategy.java
index 60246b2..a965aec 100644
--- a/core/camel-base/src/main/java/org/apache/camel/processor/aggregate/ShareUnitOfWorkAggregationStrategy.java
+++ b/core/camel-base/src/main/java/org/apache/camel/processor/aggregate/ShareUnitOfWorkAggregationStrategy.java
@@ -24,8 +24,6 @@ import org.apache.camel.ExtendedExchange;
 import org.apache.camel.support.service.ServiceHelper;
 import org.apache.camel.support.service.ServiceSupport;
 
-import static org.apache.camel.support.ExchangeHelper.hasExceptionBeenHandledByErrorHandler;
-
 /**
  * An {@link AggregationStrategy} which are used when the option <tt>shareUnitOfWork</tt> is enabled
  * on EIPs such as multicast, splitter or recipientList.
@@ -106,9 +104,9 @@ public final class ShareUnitOfWorkAggregationStrategy extends ServiceSupport imp
     }
 
     protected void propagateFailure(Exchange answer, Exchange newExchange) {
+        ExtendedExchange nee = (ExtendedExchange) newExchange;
         // if new exchange failed then propagate all the error related properties to the answer
-        boolean exceptionHandled = hasExceptionBeenHandledByErrorHandler(newExchange);
-        if (exceptionHandled || newExchange.isFailed() || newExchange.isRollbackOnly() || newExchange.isRollbackOnlyLast()) {
+        if (nee.isFailed() || nee.isRollbackOnly() || nee.isRollbackOnlyLast() || nee.isErrorHandlerHandled()) {
             if (newExchange.getException() != null) {
                 answer.setException(newExchange.getException());
             }
diff --git a/core/camel-base/src/main/java/org/apache/camel/processor/aggregate/UseLatestAggregationStrategy.java b/core/camel-base/src/main/java/org/apache/camel/processor/aggregate/UseLatestAggregationStrategy.java
index 07a911b..35fe5e8 100644
--- a/core/camel-base/src/main/java/org/apache/camel/processor/aggregate/UseLatestAggregationStrategy.java
+++ b/core/camel-base/src/main/java/org/apache/camel/processor/aggregate/UseLatestAggregationStrategy.java
@@ -18,8 +18,7 @@ package org.apache.camel.processor.aggregate;
 
 import org.apache.camel.AggregationStrategy;
 import org.apache.camel.Exchange;
-
-import static org.apache.camel.support.ExchangeHelper.hasExceptionBeenHandledByErrorHandler;
+import org.apache.camel.ExtendedExchange;
 
 /**
  * An {@link AggregationStrategy} which just uses the latest exchange which is useful
@@ -71,8 +70,8 @@ public class UseLatestAggregationStrategy implements AggregationStrategy {
         }
 
         // propagate exception from old exchange if there isn't already an exception
-        boolean exceptionHandled = hasExceptionBeenHandledByErrorHandler(oldExchange);
-        if (exceptionHandled || oldExchange.isFailed() || oldExchange.isRollbackOnly() || oldExchange.isRollbackOnlyLast()) {
+        ExtendedExchange oee = (ExtendedExchange) oldExchange;
+        if (oee.isFailed() || oee.isRollbackOnly() || oee.isRollbackOnlyLast() || oee.isErrorHandlerHandled()) {
             // propagate failure by using old exchange as the answer
             return oldExchange;
         }
diff --git a/core/camel-support/src/main/java/org/apache/camel/support/DefaultExchange.java b/core/camel-support/src/main/java/org/apache/camel/support/DefaultExchange.java
index ad60123..8383ad2 100644
--- a/core/camel-support/src/main/java/org/apache/camel/support/DefaultExchange.java
+++ b/core/camel-support/src/main/java/org/apache/camel/support/DefaultExchange.java
@@ -662,6 +662,11 @@ public final class DefaultExchange implements ExtendedExchange {
     }
 
     @Override
+    public boolean isErrorHandlerHandled() {
+        return errorHandlerHandled != null && errorHandlerHandled;
+    }
+
+    @Override
     public void setErrorHandlerHandled(Boolean errorHandlerHandled) {
         this.errorHandlerHandled = errorHandlerHandled;
     }
diff --git a/core/camel-support/src/main/java/org/apache/camel/support/ExchangeHelper.java b/core/camel-support/src/main/java/org/apache/camel/support/ExchangeHelper.java
index 384271c..e719510 100644
--- a/core/camel-support/src/main/java/org/apache/camel/support/ExchangeHelper.java
+++ b/core/camel-support/src/main/java/org/apache/camel/support/ExchangeHelper.java
@@ -662,18 +662,6 @@ public final class ExchangeHelper {
     }
 
     /**
-     * Tests whether the exchange has already been handled by the error handler
-     *
-     * @param exchange the exchange
-     * @return <tt>true</tt> if handled already by error handler, <tt>false</tt> otherwise
-     */
-    public static boolean hasExceptionBeenHandledByErrorHandler(Exchange exchange) {
-        ExtendedExchange ee = (ExtendedExchange) exchange;
-        Boolean handled = ee.getErrorHandlerHandled();
-        return handled != null && handled;
-    }
-
-    /**
      * Extracts the body from the given future, that represents a handle to an asynchronous exchange.
      * <p/>
      * Will wait until the future task is complete.


[camel] 02/02: Regen

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 a9d34cfa84850567216669ddd73ddfc171e6d5b1
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Tue Jan 28 12:37:28 2020 +0100

    Regen
---
 components/camel-bindy/src/main/docs/bindy-dataformat.adoc | 2 +-
 docs/components/modules/ROOT/pages/bindy-dataformat.adoc   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/components/camel-bindy/src/main/docs/bindy-dataformat.adoc b/components/camel-bindy/src/main/docs/bindy-dataformat.adoc
index e79fece..6603f85 100644
--- a/components/camel-bindy/src/main/docs/bindy-dataformat.adoc
+++ b/components/camel-bindy/src/main/docs/bindy-dataformat.adoc
@@ -59,7 +59,7 @@ The Bindy dataformat supports 6 options, which are listed below.
 [width="100%",cols="2s,1m,1m,6",options="header"]
 |===
 | Name | Default | Java Type | Description
-| type | Fixed | BindyType | Whether to use Csv, Fixed, or KeyValue.
+| type | KeyValue | BindyType | Whether to use Csv, Fixed, or KeyValue.
 | classType |  | String | Name of model class to use.
 | locale |  | String | To configure a default locale to use, such as us for united states. To use the JVM platform default locale then use the name default
 | unwrapSingleInstance | true | Boolean | When unmarshalling should a single instance be unwrapped and returned instead of wrapped in a java.util.List.
diff --git a/docs/components/modules/ROOT/pages/bindy-dataformat.adoc b/docs/components/modules/ROOT/pages/bindy-dataformat.adoc
index 315ca94..3192660 100644
--- a/docs/components/modules/ROOT/pages/bindy-dataformat.adoc
+++ b/docs/components/modules/ROOT/pages/bindy-dataformat.adoc
@@ -60,7 +60,7 @@ The Bindy dataformat supports 6 options, which are listed below.
 [width="100%",cols="2s,1m,1m,6",options="header"]
 |===
 | Name | Default | Java Type | Description
-| type | Fixed | BindyType | Whether to use Csv, Fixed, or KeyValue.
+| type | KeyValue | BindyType | Whether to use Csv, Fixed, or KeyValue.
 | classType |  | String | Name of model class to use.
 | locale |  | String | To configure a default locale to use, such as us for united states. To use the JVM platform default locale then use the name default
 | unwrapSingleInstance | true | Boolean | When unmarshalling should a single instance be unwrapped and returned instead of wrapped in a java.util.List.