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 2021/01/30 15:12:21 UTC

[camel] branch camel-3.7.x updated (59e6848 -> 2bf4694)

This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a change to branch camel-3.7.x
in repository https://gitbox.apache.org/repos/asf/camel.git.


    from 59e6848  CAMEL-16114: Fixed jackson dataformat unmarshal type for arrays. Thanks to Bob Paulin for unit test.
     new 02a4bce  Polished
     new 2bf4694  CAMEL-16091: Fixed Enricher EIP to handover onCompletions to UoW so they are executed at end of routing. PollEnricher already did this. Thanks to Michał Ostrowski for test case in camel-netty-http.

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:
 .../netty/http/NettyEnricherLeakTest.java          | 75 ++++++++++++++++++++++
 .../src/main/java/org/apache/camel/Component.java  |  2 -
 .../camel/spi/HeaderFilterStrategyAware.java       |  2 -
 .../camel/builder/AggregationStrategies.java       |  5 --
 .../java/org/apache/camel/processor/Enricher.java  |  4 ++
 .../aggregate/AbstractListAggregationStrategy.java |  2 -
 .../aggregate/StringAggregationStrategy.java       |  8 +--
 .../toolbox/FlexibleAggregationStrategiesTest.java |  2 -
 8 files changed, 80 insertions(+), 20 deletions(-)
 create mode 100644 components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyEnricherLeakTest.java


[camel] 01/02: Polished

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch camel-3.7.x
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 02a4bce5b8ee1d139aaccd8db232694b653c3333
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Sat Jan 30 15:47:43 2021 +0100

    Polished
---
 core/camel-api/src/main/java/org/apache/camel/Component.java        | 2 --
 .../main/java/org/apache/camel/spi/HeaderFilterStrategyAware.java   | 2 --
 .../main/java/org/apache/camel/builder/AggregationStrategies.java   | 5 -----
 .../camel/processor/aggregate/AbstractListAggregationStrategy.java  | 2 --
 .../apache/camel/processor/aggregate/StringAggregationStrategy.java | 6 ------
 .../camel/util/toolbox/FlexibleAggregationStrategiesTest.java       | 2 --
 6 files changed, 19 deletions(-)

diff --git a/core/camel-api/src/main/java/org/apache/camel/Component.java b/core/camel-api/src/main/java/org/apache/camel/Component.java
index 298aa4e..a6b7529 100644
--- a/core/camel-api/src/main/java/org/apache/camel/Component.java
+++ b/core/camel-api/src/main/java/org/apache/camel/Component.java
@@ -62,8 +62,6 @@ public interface Component extends CamelContextAware, Service {
      * <b>Notice:</b> When using raw uris, then the parameter values is raw as well.
      *
      * @return <tt>true</tt> to use raw uris, <tt>false</tt> to use encoded uris (default).
-     *
-     * @since  Camel 2.11.0
      */
     boolean useRawUri();
 
diff --git a/core/camel-api/src/main/java/org/apache/camel/spi/HeaderFilterStrategyAware.java b/core/camel-api/src/main/java/org/apache/camel/spi/HeaderFilterStrategyAware.java
index bf0f553..3e84e84 100644
--- a/core/camel-api/src/main/java/org/apache/camel/spi/HeaderFilterStrategyAware.java
+++ b/core/camel-api/src/main/java/org/apache/camel/spi/HeaderFilterStrategyAware.java
@@ -18,8 +18,6 @@ package org.apache.camel.spi;
 
 /**
  * An interface to represent an object which can make use of injected {@link HeaderFilterStrategy}.
- * 
- * @since 1.5
  */
 public interface HeaderFilterStrategyAware {
 
diff --git a/core/camel-core-model/src/main/java/org/apache/camel/builder/AggregationStrategies.java b/core/camel-core-model/src/main/java/org/apache/camel/builder/AggregationStrategies.java
index d6dc3fa..34489f1 100644
--- a/core/camel-core-model/src/main/java/org/apache/camel/builder/AggregationStrategies.java
+++ b/core/camel-core-model/src/main/java/org/apache/camel/builder/AggregationStrategies.java
@@ -27,8 +27,6 @@ import org.apache.camel.processor.aggregate.UseOriginalAggregationStrategy;
 /**
  * Toolbox class to create commonly used Aggregation Strategies in a fluent manner. For more information about the
  * supported {@link AggregationStrategy}, see links to the Javadocs of the relevant class below.
- * 
- * @since 2.12
  */
 public final class AggregationStrategies {
 
@@ -145,8 +143,6 @@ public final class AggregationStrategies {
 
     /**
      * Creates a {@link StringAggregationStrategy}.
-     * 
-     * @since 3.0.0
      */
     public static StringAggregationStrategy string() {
         return new StringAggregationStrategy();
@@ -156,7 +152,6 @@ public final class AggregationStrategies {
      * Creates a {@link StringAggregationStrategy} with delimiter.
      * 
      * @param delimiter The delimiter to join with.
-     * @since           3.0.0
      */
     public static StringAggregationStrategy string(String delimiter) {
         return string().delimiter(delimiter);
diff --git a/core/camel-core-processor/src/main/java/org/apache/camel/processor/aggregate/AbstractListAggregationStrategy.java b/core/camel-core-processor/src/main/java/org/apache/camel/processor/aggregate/AbstractListAggregationStrategy.java
index 1dbe56e..8d0209d 100644
--- a/core/camel-core-processor/src/main/java/org/apache/camel/processor/aggregate/AbstractListAggregationStrategy.java
+++ b/core/camel-core-processor/src/main/java/org/apache/camel/processor/aggregate/AbstractListAggregationStrategy.java
@@ -31,8 +31,6 @@ import org.apache.camel.Exchange;
  * {@link org.apache.camel.Message#setBody(Object)} or be kept as a property on the exchange. <br/>
  * The default behavior to store as message body, allows to more easily group together a list of values and have its
  * result stored as a {@link List} on the completed {@link Exchange}.
- *
- * @since 2.11
  */
 public abstract class AbstractListAggregationStrategy<V> implements AggregationStrategy {
 
diff --git a/core/camel-core-processor/src/main/java/org/apache/camel/processor/aggregate/StringAggregationStrategy.java b/core/camel-core-processor/src/main/java/org/apache/camel/processor/aggregate/StringAggregationStrategy.java
index 20173b0..43422a6 100644
--- a/core/camel-core-processor/src/main/java/org/apache/camel/processor/aggregate/StringAggregationStrategy.java
+++ b/core/camel-core-processor/src/main/java/org/apache/camel/processor/aggregate/StringAggregationStrategy.java
@@ -26,8 +26,6 @@ import org.apache.camel.support.builder.ExpressionBuilder;
  * {@link String} as the message body.
  *
  * This aggregation strategy can used in combination with {@link org.apache.camel.processor.Splitter} to batch messages
- * 
- * @since 3.0.0
  */
 public class StringAggregationStrategy implements AggregationStrategy {
 
@@ -38,7 +36,6 @@ public class StringAggregationStrategy implements AggregationStrategy {
      * Set delimiter used for joining aggregated String
      * 
      * @param  delimiter The delimiter to join with. Default empty String
-     * @return
      */
     public StringAggregationStrategy delimiter(String delimiter) {
         this.delimiter = delimiter;
@@ -58,9 +55,6 @@ public class StringAggregationStrategy implements AggregationStrategy {
         return this;
     }
 
-    /**
-     * {@inheritDoc}
-     */
     @Override
     public Exchange aggregate(Exchange oldExchange, Exchange newExchange) {
         StringBuffer result; // Aggregate in StringBuffer instead of StringBuilder, to make it thread safe
diff --git a/core/camel-core/src/test/java/org/apache/camel/util/toolbox/FlexibleAggregationStrategiesTest.java b/core/camel-core/src/test/java/org/apache/camel/util/toolbox/FlexibleAggregationStrategiesTest.java
index d38b2cd..6bd4445 100644
--- a/core/camel-core/src/test/java/org/apache/camel/util/toolbox/FlexibleAggregationStrategiesTest.java
+++ b/core/camel-core/src/test/java/org/apache/camel/util/toolbox/FlexibleAggregationStrategiesTest.java
@@ -44,8 +44,6 @@ import static org.junit.jupiter.api.Assertions.*;
 
 /**
  * Unit tests for the {@link FlexibleAggregationStrategy}.
- * 
- * @since 2.12
  */
 public class FlexibleAggregationStrategiesTest extends ContextTestSupport {
 


[camel] 02/02: CAMEL-16091: Fixed Enricher EIP to handover onCompletions to UoW so they are executed at end of routing. PollEnricher already did this. Thanks to Michał Ostrowski for test case in camel-netty-http.

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch camel-3.7.x
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 2bf4694c2b15c53be5ec685bcae8e7a27a575471
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Sat Jan 30 16:07:27 2021 +0100

    CAMEL-16091: Fixed Enricher EIP to handover onCompletions to UoW so they are executed at end of routing. PollEnricher already did this. Thanks to Michał Ostrowski for test case in camel-netty-http.
---
 .../netty/http/NettyEnricherLeakTest.java          | 75 ++++++++++++++++++++++
 .../java/org/apache/camel/processor/Enricher.java  |  4 ++
 .../aggregate/StringAggregationStrategy.java       |  2 +-
 3 files changed, 80 insertions(+), 1 deletion(-)

diff --git a/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyEnricherLeakTest.java b/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyEnricherLeakTest.java
new file mode 100644
index 0000000..c0316de
--- /dev/null
+++ b/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyEnricherLeakTest.java
@@ -0,0 +1,75 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.netty.http;
+
+import io.netty.util.ResourceLeakDetector;
+import org.apache.camel.builder.AggregationStrategies;
+import org.apache.camel.builder.RouteBuilder;
+import org.junit.jupiter.api.Test;
+
+public class NettyEnricherLeakTest extends BaseNettyTest {
+
+    @Override
+    public boolean isUseRouteBuilder() {
+        return false;
+    }
+
+    @Test
+    public void leakNoTest() throws Exception {
+        context.addRoutes(new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                ResourceLeakDetector.setLevel(ResourceLeakDetector.Level.PARANOID);
+
+                from("netty-http:http://localhost:" + getPort() + "/test")
+                        .transform().simple("${body}");
+
+                from("direct:outer")
+                        .to("netty-http:http://localhost:" + getPort() + "/test?disconnect=true");
+            }
+        });
+        context.start();
+
+        ResourceLeakDetector.setLevel(ResourceLeakDetector.Level.PARANOID);
+        for (int i = 0; i < 10; ++i) {
+            template.requestBody("direct:outer", "input", String.class);
+        }
+    }
+
+    @Test
+    public void leakTest() throws Exception {
+        context.addRoutes(new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                ResourceLeakDetector.setLevel(ResourceLeakDetector.Level.PARANOID);
+
+                from("netty-http:http://localhost:" + getPort() + "/test")
+                        .transform().simple("${body}");
+
+                from("direct:outer")
+                        .enrich("netty-http:http://localhost:" + getPort() + "/test?disconnect=true",
+                                AggregationStrategies.string(), false, false);
+            }
+        });
+        context.start();
+
+        ResourceLeakDetector.setLevel(ResourceLeakDetector.Level.PARANOID);
+        for (int i = 0; i < 10; ++i) {
+            template.requestBody("direct:outer", "input", String.class);
+        }
+    }
+}
diff --git a/core/camel-core-processor/src/main/java/org/apache/camel/processor/Enricher.java b/core/camel-core-processor/src/main/java/org/apache/camel/processor/Enricher.java
index ac2565d..4038125 100644
--- a/core/camel-core-processor/src/main/java/org/apache/camel/processor/Enricher.java
+++ b/core/camel-core-processor/src/main/java/org/apache/camel/processor/Enricher.java
@@ -237,6 +237,10 @@ public class Enricher extends AsyncProcessorSupport implements IdAware, RouteIdA
                         if (aggregatedExchange != null) {
                             // copy aggregation result onto original exchange (preserving pattern)
                             copyResultsPreservePattern(exchange, aggregatedExchange);
+                            // handover any synchronization
+                            if (resourceExchange != null) {
+                                resourceExchange.adapt(ExtendedExchange.class).handoverCompletions(exchange);
+                            }
                         }
                     } catch (Throwable e) {
                         // if the aggregationStrategy threw an exception, set it on the original exchange
diff --git a/core/camel-core-processor/src/main/java/org/apache/camel/processor/aggregate/StringAggregationStrategy.java b/core/camel-core-processor/src/main/java/org/apache/camel/processor/aggregate/StringAggregationStrategy.java
index 43422a6..b0121bc 100644
--- a/core/camel-core-processor/src/main/java/org/apache/camel/processor/aggregate/StringAggregationStrategy.java
+++ b/core/camel-core-processor/src/main/java/org/apache/camel/processor/aggregate/StringAggregationStrategy.java
@@ -35,7 +35,7 @@ public class StringAggregationStrategy implements AggregationStrategy {
     /**
      * Set delimiter used for joining aggregated String
      * 
-     * @param  delimiter The delimiter to join with. Default empty String
+     * @param delimiter The delimiter to join with. Default empty String
      */
     public StringAggregationStrategy delimiter(String delimiter) {
         this.delimiter = delimiter;