cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject cxf git commit: [CXF-6513] Completing the exchange in case of async requests
Date Wed, 05 Aug 2015 11:30:57 GMT
Repository: cxf
Updated Branches:
  refs/heads/master ff8260927 -> 95e8711bd


[CXF-6513] Completing the exchange in case of async requests


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

Branch: refs/heads/master
Commit: 95e8711bd835efc1a71f5089ff49acf0ed5defb2
Parents: ff82609
Author: Sergey Beryozkin <sberyozkin@gmail.com>
Authored: Wed Aug 5 12:30:40 2015 +0100
Committer: Sergey Beryozkin <sberyozkin@gmail.com>
Committed: Wed Aug 5 12:30:40 2015 +0100

----------------------------------------------------------------------
 .../org/apache/cxf/jaxrs/client/AbstractClient.java    |  2 +-
 .../org/apache/cxf/jaxrs/client/ClientProxyImpl.java   |  9 ++-------
 .../java/org/apache/cxf/jaxrs/client/WebClient.java    | 13 ++++---------
 3 files changed, 7 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/95e8711b/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/AbstractClient.java
----------------------------------------------------------------------
diff --git a/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/AbstractClient.java b/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/AbstractClient.java
index 958e5a2..bb1b76e 100644
--- a/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/AbstractClient.java
+++ b/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/AbstractClient.java
@@ -517,7 +517,7 @@ public abstract class AbstractClient implements Client {
             && MessageUtils.isTrue(outMessage.getContextualProperty("response.stream.auto.close"));
     }
     
-    protected void completeExchange(Object response, Exchange exchange, boolean proxy) {
+    protected void completeExchange(Exchange exchange, boolean proxy) {
         // higher level conduits such as FailoverTargetSelector need to
         // clear the request state but a fair number of response objects 
         // depend on InputStream being still open thus lower-level conduits

http://git-wip-us.apache.org/repos/asf/cxf/blob/95e8711b/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/ClientProxyImpl.java
----------------------------------------------------------------------
diff --git a/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/ClientProxyImpl.java b/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/ClientProxyImpl.java
index c32210f..c56db95 100644
--- a/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/ClientProxyImpl.java
+++ b/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/ClientProxyImpl.java
@@ -700,15 +700,10 @@ public class ClientProxyImpl extends AbstractClient implements
                 return results[0];
             }
             
-            Object response = null;
             try {
-                response = handleResponse(outMessage, ori.getClassResourceInfo().getServiceClass());
-                return response;
-            } catch (Exception ex) {
-                response = ex;
-                throw ex;
+                return handleResponse(outMessage, ori.getClassResourceInfo().getServiceClass());
             } finally {
-                completeExchange(response, outMessage.getExchange(), true);
+                completeExchange(outMessage.getExchange(), true);
             }
         } finally {
             if (origLoader != null) {

http://git-wip-us.apache.org/repos/asf/cxf/blob/95e8711b/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/WebClient.java
----------------------------------------------------------------------
diff --git a/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/WebClient.java b/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/WebClient.java
index 3c3015a..4b1ab4d 100644
--- a/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/WebClient.java
+++ b/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/WebClient.java
@@ -1026,6 +1026,8 @@ public class WebClient extends AbstractClient {
             } catch (Throwable t) {
                 cb.handleException(message, t);
                 return;
+            } finally {
+                completeExchange(message.getExchange(), false);
             }
         }
         if (cb.getResponseClass() == null || Response.class.equals(cb.getResponseClass()))
{
@@ -1150,17 +1152,10 @@ public class WebClient extends AbstractClient {
                 ? (ProcessingException)ex : new ProcessingException(ex); 
         }
         
-        Response response = null;
-        Object entity = null;
         try {
-            response = handleResponse(m, responseClass, outGenericType);
-            entity = response.getEntity();
-            return response;
-        } catch (RuntimeException ex) {
-            entity = ex;
-            throw ex;
+            return handleResponse(m, responseClass, outGenericType);
         } finally {
-            completeExchange(entity, m.getExchange(), false);
+            completeExchange(m.getExchange(), false);
         }
     }
     


Mime
View raw message