Repository: cxf
Updated Branches:
  refs/heads/3.0.x-fixes ae1e17b92 -> 85975ce59


[CXF-6340] More compliant implementation of AsyncResponse.cancel


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

Branch: refs/heads/3.0.x-fixes
Commit: 85975ce5987fb8639e5862d90a2bdf90ff50775a
Parents: ae1e17b
Author: Sergey Beryozkin <sberyoz...@talend.com>
Authored: Thu Apr 9 12:02:21 2015 +0100
Committer: Sergey Beryozkin <sberyoz...@talend.com>
Committed: Thu Apr 9 12:03:12 2015 +0100

----------------------------------------------------------------------
 .../java/org/apache/cxf/jaxrs/impl/AsyncResponseImpl.java    | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/85975ce5/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/AsyncResponseImpl.java
----------------------------------------------------------------------
diff --git 
a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/AsyncResponseImpl.java
 
b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/AsyncResponseImpl.java
index 69ba838..2f3ce44 100644
--- 
a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/AsyncResponseImpl.java
+++ 
b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/AsyncResponseImpl.java
@@ -85,6 +85,9 @@ public class AsyncResponseImpl implements AsyncResponse, 
ContinuationCallback {
         if (isCancelledOrNotSuspended()) {
             return false;
         }
+        return doResumeFinal(response);
+    }
+    private synchronized boolean doResumeFinal(Object response) {
         inMessage.getExchange().put(AsyncResponse.class, this);
         cont.setObject(response);
         resumedByApplication = true;
@@ -112,6 +115,9 @@ public class AsyncResponseImpl implements AsyncResponse, 
ContinuationCallback {
     }
     
     private synchronized boolean doCancel(String retryAfterHeader) {
+        if (cancelled) {
+            return true;
+        }
         if (!isSuspended()) {
             return false;
         }
@@ -119,8 +125,8 @@ public class AsyncResponseImpl implements AsyncResponse, 
ContinuationCallback {
         if (retryAfterHeader != null) {
             rb.header(HttpHeaders.RETRY_AFTER, retryAfterHeader);
         }
-        doResume(rb.build());
         cancelled = true;
+        doResumeFinal(rb.build());
         return cancelled;
     }
 

Reply via email to