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 2016/04/07 10:42:52 UTC

[1/4] camel git commit: Check to see if disableStreamCache is enabled before consuming the httpResponse entity

Repository: camel
Updated Branches:
  refs/heads/camel-2.17.x 6efd0461d -> cef2609c5
  refs/heads/master d943910b2 -> d72b9af01


Check to see if disableStreamCache is enabled before consuming the httpResponse entity


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/f918aad6
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/f918aad6
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/f918aad6

Branch: refs/heads/master
Commit: f918aad67d9164fa4764c16e744eb06be22afa34
Parents: d943910
Author: Edward Welch <ed...@edjusted.com>
Authored: Wed Apr 6 07:35:10 2016 -0400
Committer: Claus Ibsen <da...@apache.org>
Committed: Thu Apr 7 10:30:09 2016 +0200

----------------------------------------------------------------------
 .../main/java/org/apache/camel/component/http4/HttpProducer.java   | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/f918aad6/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpProducer.java
----------------------------------------------------------------------
diff --git a/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpProducer.java b/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpProducer.java
index 7622d02..4edc6c5 100644
--- a/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpProducer.java
+++ b/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpProducer.java
@@ -179,7 +179,7 @@ public class HttpProducer extends DefaultProducer {
                 }
             }
         } finally {
-            if (httpResponse != null) {
+            if (httpResponse != null && !getEndpoint().isDisableStreamCache()) {
                 try {
                     EntityUtils.consume(httpResponse.getEntity());
                 } catch (IOException e) {


[2/4] camel git commit: CAMEL-9768: Close the stream either now or later depending on that disable stream cache option. This closes #932.

Posted by da...@apache.org.
CAMEL-9768: Close the stream either now or later depending on that disable stream cache option. This closes #932.


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/d72b9af0
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/d72b9af0
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/d72b9af0

Branch: refs/heads/master
Commit: d72b9af01be9a0efbccb06a955b69c6239154587
Parents: f918aad
Author: Claus Ibsen <da...@apache.org>
Authored: Thu Apr 7 10:42:18 2016 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Thu Apr 7 10:42:18 2016 +0200

----------------------------------------------------------------------
 .../camel/component/http4/HttpProducer.java     | 23 ++++++++++++++++----
 1 file changed, 19 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/d72b9af0/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpProducer.java
----------------------------------------------------------------------
diff --git a/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpProducer.java b/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpProducer.java
index 4edc6c5..c59c3b8 100644
--- a/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpProducer.java
+++ b/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpProducer.java
@@ -43,6 +43,7 @@ import org.apache.camel.http.common.HttpOperationFailedException;
 import org.apache.camel.http.common.HttpProtocolHeaderFilterStrategy;
 import org.apache.camel.impl.DefaultProducer;
 import org.apache.camel.spi.HeaderFilterStrategy;
+import org.apache.camel.support.SynchronizationAdapter;
 import org.apache.camel.util.ExchangeHelper;
 import org.apache.camel.util.GZIPHelper;
 import org.apache.camel.util.IOHelper;
@@ -179,11 +180,25 @@ public class HttpProducer extends DefaultProducer {
                 }
             }
         } finally {
-            if (httpResponse != null && !getEndpoint().isDisableStreamCache()) {
+            final HttpResponse response = httpResponse;
+            if (httpResponse != null && getEndpoint().isDisableStreamCache()) {
+                // close the stream at the end of the exchange to ensure it gets eventually closed later
+                exchange.addOnCompletion(new SynchronizationAdapter() {
+                    @Override
+                    public void onDone(Exchange exchange) {
+                        try {
+                            EntityUtils.consume(response.getEntity());
+                        } catch (Throwable e) {
+                            // ignore
+                        }
+                    }
+                });
+            } else if (httpResponse != null) {
+                // close the stream now
                 try {
-                    EntityUtils.consume(httpResponse.getEntity());
-                } catch (IOException e) {
-                    // nothing we could do
+                    EntityUtils.consume(response.getEntity());
+                } catch (Throwable e) {
+                    // ignore
                 }
             }
         }


[4/4] camel git commit: CAMEL-9768: Close the stream either now or later depending on that disable stream cache option. This closes #932.

Posted by da...@apache.org.
CAMEL-9768: Close the stream either now or later depending on that disable stream cache option. This closes #932.


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/cef2609c
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/cef2609c
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/cef2609c

Branch: refs/heads/camel-2.17.x
Commit: cef2609c5bdc99fad174618861eac304dd4052da
Parents: fbf5bcf
Author: Claus Ibsen <da...@apache.org>
Authored: Thu Apr 7 10:42:18 2016 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Thu Apr 7 10:42:44 2016 +0200

----------------------------------------------------------------------
 .../camel/component/http4/HttpProducer.java     | 23 ++++++++++++++++----
 1 file changed, 19 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/cef2609c/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpProducer.java
----------------------------------------------------------------------
diff --git a/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpProducer.java b/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpProducer.java
index 4edc6c5..c59c3b8 100644
--- a/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpProducer.java
+++ b/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpProducer.java
@@ -43,6 +43,7 @@ import org.apache.camel.http.common.HttpOperationFailedException;
 import org.apache.camel.http.common.HttpProtocolHeaderFilterStrategy;
 import org.apache.camel.impl.DefaultProducer;
 import org.apache.camel.spi.HeaderFilterStrategy;
+import org.apache.camel.support.SynchronizationAdapter;
 import org.apache.camel.util.ExchangeHelper;
 import org.apache.camel.util.GZIPHelper;
 import org.apache.camel.util.IOHelper;
@@ -179,11 +180,25 @@ public class HttpProducer extends DefaultProducer {
                 }
             }
         } finally {
-            if (httpResponse != null && !getEndpoint().isDisableStreamCache()) {
+            final HttpResponse response = httpResponse;
+            if (httpResponse != null && getEndpoint().isDisableStreamCache()) {
+                // close the stream at the end of the exchange to ensure it gets eventually closed later
+                exchange.addOnCompletion(new SynchronizationAdapter() {
+                    @Override
+                    public void onDone(Exchange exchange) {
+                        try {
+                            EntityUtils.consume(response.getEntity());
+                        } catch (Throwable e) {
+                            // ignore
+                        }
+                    }
+                });
+            } else if (httpResponse != null) {
+                // close the stream now
                 try {
-                    EntityUtils.consume(httpResponse.getEntity());
-                } catch (IOException e) {
-                    // nothing we could do
+                    EntityUtils.consume(response.getEntity());
+                } catch (Throwable e) {
+                    // ignore
                 }
             }
         }


[3/4] camel git commit: Check to see if disableStreamCache is enabled before consuming the httpResponse entity

Posted by da...@apache.org.
Check to see if disableStreamCache is enabled before consuming the httpResponse entity


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/fbf5bcf8
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/fbf5bcf8
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/fbf5bcf8

Branch: refs/heads/camel-2.17.x
Commit: fbf5bcf8df972ea531fd1e469acd08a77f5f736e
Parents: 6efd046
Author: Edward Welch <ed...@edjusted.com>
Authored: Wed Apr 6 07:35:10 2016 -0400
Committer: Claus Ibsen <da...@apache.org>
Committed: Thu Apr 7 10:42:35 2016 +0200

----------------------------------------------------------------------
 .../main/java/org/apache/camel/component/http4/HttpProducer.java   | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/fbf5bcf8/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpProducer.java
----------------------------------------------------------------------
diff --git a/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpProducer.java b/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpProducer.java
index 7622d02..4edc6c5 100644
--- a/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpProducer.java
+++ b/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpProducer.java
@@ -179,7 +179,7 @@ public class HttpProducer extends DefaultProducer {
                 }
             }
         } finally {
-            if (httpResponse != null) {
+            if (httpResponse != null && !getEndpoint().isDisableStreamCache()) {
                 try {
                     EntityUtils.consume(httpResponse.getEntity());
                 } catch (IOException e) {