cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ningji...@apache.org
Subject svn commit: r1513371 - in /cxf/branches/2.7.x-fixes: ./ api/src/main/java/org/apache/cxf/endpoint/ClientImpl.java systests/jaxws/pom.xml systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/JaxwsAsyncFailOverTest.java
Date Tue, 13 Aug 2013 07:07:05 GMT
Author: ningjiang
Date: Tue Aug 13 07:07:05 2013
New Revision: 1513371

URL: http://svn.apache.org/r1513371
Log:
Merged revisions 1513076 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/trunk

........
  r1513076 | ningjiang | 2013-08-12 16:35:06 +0800 (Mon, 12 Aug 2013) | 1 line
  
  CXF-5196 fixed the issue that Failover feature doesn't work when client uses async invocation
........

Added:
    cxf/branches/2.7.x-fixes/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/JaxwsAsyncFailOverTest.java
      - copied unchanged from r1513076, cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/JaxwsAsyncFailOverTest.java
Modified:
    cxf/branches/2.7.x-fixes/   (props changed)
    cxf/branches/2.7.x-fixes/api/src/main/java/org/apache/cxf/endpoint/ClientImpl.java
    cxf/branches/2.7.x-fixes/systests/jaxws/pom.xml

Propchange: cxf/branches/2.7.x-fixes/
------------------------------------------------------------------------------
    svn:mergeinfo = /cxf/trunk:1513076

Propchange: cxf/branches/2.7.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.7.x-fixes/api/src/main/java/org/apache/cxf/endpoint/ClientImpl.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/api/src/main/java/org/apache/cxf/endpoint/ClientImpl.java?rev=1513371&r1=1513370&r2=1513371&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/api/src/main/java/org/apache/cxf/endpoint/ClientImpl.java (original)
+++ cxf/branches/2.7.x-fixes/api/src/main/java/org/apache/cxf/endpoint/ClientImpl.java Tue
Aug 13 07:07:05 2013
@@ -474,7 +474,7 @@ public class ClientImpl
         return doInvoke(null, oi, params, context, exchange);
     }
 
-    private Object[] doInvoke(ClientCallback callback,
+    private Object[] doInvoke(final ClientCallback callback,
                               BindingOperationInfo oi,
                               Object[] params,
                               Map<String, Object> context,
@@ -532,7 +532,31 @@ public class ClientImpl
 
             PhaseInterceptorChain chain = setupInterceptorChain(endpoint);
             message.setInterceptorChain(chain);
-            chain.setFaultObserver(outFaultObserver);
+            if (callback == null) {
+                chain.setFaultObserver(outFaultObserver);
+            } else {
+                // We need to wrap the outFaultObserver if the callback is not null
+                // calling the conduitSelector.complete to make sure the fail over feature
works
+                chain.setFaultObserver(new MessageObserver() {
+                    public void onMessage(Message message) {
+                        Exception ex = message.getContent(Exception.class);
+                        if (ex != null) {
+                            getConduitSelector().complete(message.getExchange());
+                            if (message.getContent(Exception.class) == null) {
+                                // handle the right response
+                                List<Object> resList = null;
+                                Message inMsg = message.getExchange().getInMessage();
+                                Map<String, Object> ctx = responseContext.get(Thread.currentThread());
+                                resList = CastUtils.cast(inMsg.getContent(List.class));
+                                Object[] result = resList == null ? null : resList.toArray();
+                                callback.handleResponse(ctx, result);
+                                return;
+                            }
+                        }
+                        outFaultObserver.onMessage(message);
+                    }
+                });
+            }
             prepareConduitSelector(message);
 
             // add additional interceptors and such

Modified: cxf/branches/2.7.x-fixes/systests/jaxws/pom.xml
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/systests/jaxws/pom.xml?rev=1513371&r1=1513370&r2=1513371&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/systests/jaxws/pom.xml (original)
+++ cxf/branches/2.7.x-fixes/systests/jaxws/pom.xml Tue Aug 13 07:07:05 2013
@@ -136,6 +136,11 @@
             <version>${project.version}</version>
         </dependency>
         <dependency>
+            <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-rt-features-clustering</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
             <groupId>org.slf4j</groupId>
             <artifactId>slf4j-jdk14</artifactId>
             <scope>test</scope>



Mime
View raw message