This is an automated email from the ASF dual-hosted git repository.

reta pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cxf.git


The following commit(s) were added to refs/heads/master by this push:
     new e0b16df  CXF-8242: Stop blocking executor thread on microprofile rest 
asynchronous call. Fixing JAX-WS handler invocation flow.
e0b16df is described below

commit e0b16dfca37345e0fd51b3934d91b635ef5a0078
Author: reta <[email protected]>
AuthorDate: Thu Apr 2 18:51:13 2020 -0400

    CXF-8242: Stop blocking executor thread on microprofile rest asynchronous 
call. Fixing JAX-WS handler invocation flow.
---
 .../src/main/java/org/apache/cxf/jaxws/JaxwsClientCallback.java  | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git 
a/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxwsClientCallback.java 
b/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxwsClientCallback.java
index 28b4c24..8f1ed9c 100644
--- 
a/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxwsClientCallback.java
+++ 
b/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxwsClientCallback.java
@@ -39,8 +39,8 @@ class JaxwsClientCallback<T> extends ClientCallback {
     }
     public void handleResponse(Map<String, Object> ctx, Object[] res) {
         context = ctx;
-        delegate.complete(res);
         
+        // The handler has to be called *before* future completes
         if (handler != null) {
             handler.handleResponse(new Response<T>() {
                 protected boolean cancelled;
@@ -76,6 +76,8 @@ class JaxwsClientCallback<T> extends ClientCallback {
             });
         }
         
+        delegate.complete(res);
+        
         synchronized (this) {
             notifyAll();
         }
@@ -84,7 +86,7 @@ class JaxwsClientCallback<T> extends ClientCallback {
     @Override
     public void handleException(Map<String, Object> ctx, final Throwable ex) {
         context = ctx;
-        delegate.completeExceptionally(mapThrowable(ex));
+        
         if (handler != null) {
             handler.handleResponse(new Response<T>() {
                 protected boolean cancelled;
@@ -119,6 +121,9 @@ class JaxwsClientCallback<T> extends ClientCallback {
             });
         }
 
+        // The handler has to be called *before* future completes
+        delegate.completeExceptionally(mapThrowable(ex));
+        
         synchronized (this) {
             notifyAll();
         }

Reply via email to