You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by ni...@apache.org on 2013/08/13 09:47:32 UTC

svn commit: r1513382 - in /cxf/branches/2.6.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

Author: ningjiang
Date: Tue Aug 13 07:47:31 2013
New Revision: 1513382

URL: http://svn.apache.org/r1513382
Log:
Merged revisions 1513371 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/branches/2.7.x-fixes

................
  r1513371 | ningjiang | 2013-08-13 15:07:05 +0800 (Tue, 13 Aug 2013) | 9 lines
  
  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.6.x-fixes/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/JaxwsAsyncFailOverTest.java
      - copied unchanged from r1513371, cxf/branches/2.7.x-fixes/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/JaxwsAsyncFailOverTest.java
Modified:
    cxf/branches/2.6.x-fixes/   (props changed)
    cxf/branches/2.6.x-fixes/api/src/main/java/org/apache/cxf/endpoint/ClientImpl.java
    cxf/branches/2.6.x-fixes/systests/jaxws/pom.xml

Propchange: cxf/branches/2.6.x-fixes/
------------------------------------------------------------------------------
--- svn:mergeinfo (added)
+++ svn:mergeinfo Tue Aug 13 07:47:31 2013
@@ -0,0 +1,2 @@
+/cxf/branches/2.7.x-fixes:1513371
+/cxf/trunk:1513076

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

Modified: cxf/branches/2.6.x-fixes/api/src/main/java/org/apache/cxf/endpoint/ClientImpl.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/api/src/main/java/org/apache/cxf/endpoint/ClientImpl.java?rev=1513382&r1=1513381&r2=1513382&view=diff
==============================================================================
--- cxf/branches/2.6.x-fixes/api/src/main/java/org/apache/cxf/endpoint/ClientImpl.java (original)
+++ cxf/branches/2.6.x-fixes/api/src/main/java/org/apache/cxf/endpoint/ClientImpl.java Tue Aug 13 07:47:31 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.6.x-fixes/systests/jaxws/pom.xml
URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/systests/jaxws/pom.xml?rev=1513382&r1=1513381&r2=1513382&view=diff
==============================================================================
--- cxf/branches/2.6.x-fixes/systests/jaxws/pom.xml (original)
+++ cxf/branches/2.6.x-fixes/systests/jaxws/pom.xml Tue Aug 13 07:47:31 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>