You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by se...@apache.org on 2015/04/09 13:02:35 UTC

cxf git commit: [CXF-6340] More compliant implementation of AsyncResponse.cancel

Repository: cxf
Updated Branches:
  refs/heads/master 012b14cd4 -> c518dc9cf


[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/c518dc9c
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/c518dc9c
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/c518dc9c

Branch: refs/heads/master
Commit: c518dc9cf93bf3414350a9e328b77eff2f6fe0af
Parents: 012b14c
Author: Sergey Beryozkin <sb...@talend.com>
Authored: Thu Apr 9 12:02:21 2015 +0100
Committer: Sergey Beryozkin <sb...@talend.com>
Committed: Thu Apr 9 12:02:21 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/c518dc9c/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;
     }