cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject cxf git commit: [CXF-6930] Make sure the webclient waits until the reponse chain has run before doing it's processing
Date Thu, 21 Jul 2016 21:12:50 GMT
Repository: cxf
Updated Branches:
  refs/heads/master b8ab7eaf4 -> b90b95652


[CXF-6930] Make sure the webclient waits until the reponse chain has run before doing it's
processing


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

Branch: refs/heads/master
Commit: b90b956523497107462556ae785a053eaa07956c
Parents: b8ab7ea
Author: Daniel Kulp <dkulp@apache.org>
Authored: Thu Jul 21 16:53:04 2016 -0400
Committer: Daniel Kulp <dkulp@apache.org>
Committed: Thu Jul 21 16:53:04 2016 -0400

----------------------------------------------------------------------
 .../apache/cxf/jaxrs/client/AbstractClient.java  | 19 +++++++++++++++++++
 .../cxf/systest/jaxrs/jms/JAXRSJmsTest.java      |  2 ++
 2 files changed, 21 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/b90b9565/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 f9d9aec..93d8111 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
@@ -558,6 +558,17 @@ public abstract class AbstractClient implements Client {
         Exchange exchange = message.getExchange(); 
       
         Exception ex = message.getContent(Exception.class);
+        if (ex == null) {
+            ex = message.getExchange().get(Exception.class);
+        }
+        if (ex == null && !exchange.isOneWay()) {
+            synchronized (exchange) {
+                while (exchange.get("IN_CHAIN_COMPLETE") == null) {
+                    exchange.wait();
+                }
+            }
+        }
+        ex = message.getContent(Exception.class);
         if (ex != null
             || PropertyUtils.isTrue(exchange.get(SERVICE_NOT_AVAIL_PROPERTY))
                 && PropertyUtils.isTrue(exchange.get(COMPLETE_IF_SERVICE_NOT_AVAIL_PROPERTY)))
{
@@ -1187,6 +1198,10 @@ public abstract class AbstractClient implements Client {
 
         @Override
         public void handleMessage(Message message) throws Fault {
+            synchronized (message.getExchange()) {
+                message.getExchange().put("IN_CHAIN_COMPLETE", Boolean.TRUE);
+                message.getExchange().notifyAll();
+            }
             if (message.getExchange().isSynchronous()) {
                 return;
             }
@@ -1195,6 +1210,10 @@ public abstract class AbstractClient implements Client {
 
         @Override
         public void handleFault(Message message) {
+            synchronized (message.getExchange()) {
+                message.getExchange().put("IN_CHAIN_COMPLETE", Boolean.TRUE);
+                message.getExchange().notifyAll();
+            }
             if (message.getExchange().isSynchronous()) {
                 return;
             }

http://git-wip-us.apache.org/repos/asf/cxf/blob/b90b9565/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/jms/JAXRSJmsTest.java
----------------------------------------------------------------------
diff --git a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/jms/JAXRSJmsTest.java
b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/jms/JAXRSJmsTest.java
index 4cf23e4..9567618 100644
--- a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/jms/JAXRSJmsTest.java
+++ b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/jms/JAXRSJmsTest.java
@@ -42,6 +42,7 @@ import javax.xml.bind.JAXBContext;
 import javax.xml.bind.Marshaller;
 import javax.xml.bind.Unmarshaller;
 
+import org.apache.cxf.interceptor.LoggingInInterceptor;
 import org.apache.cxf.jaxrs.client.JAXRSClientFactory;
 import org.apache.cxf.jaxrs.client.WebClient;
 import org.apache.cxf.jaxrs.model.AbstractResourceInfo;
@@ -87,6 +88,7 @@ public class JAXRSJmsTest extends AbstractBusClientServerTestBase {
              + "&jndiURL=tcp://localhost:" + JMS_PORT;
                
         WebClient client = WebClient.create(endpointAddressUrlEncoded);
+        WebClient.getConfig(client).getInInterceptors().add(new LoggingInInterceptor());
         WebClient.getConfig(client).getRequestContext()
             .put(org.apache.cxf.message.Message.REQUEST_URI, "/bookstore/books/123");
         


Mime
View raw message