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 2018/01/30 11:01:52 UTC

[cxf] branch master updated: [CXF-7575] Reintroducing the sync blocks to avoid the race conditions, with thanks to John Bellassai

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

sergeyb 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 8edb9dc  [CXF-7575] Reintroducing the sync blocks to avoid the race conditions, with thanks to John Bellassai
8edb9dc is described below

commit 8edb9dc618a0e87de7aaccadc799518fda4f866b
Author: Sergey Beryozkin <sb...@gmail.com>
AuthorDate: Tue Jan 30 11:01:38 2018 +0000

    [CXF-7575] Reintroducing the sync blocks to avoid the race conditions, with thanks to John Bellassai
---
 .../java/org/apache/cxf/jaxrs/impl/AsyncResponseImpl.java  | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

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 f52d308..dbf5f03 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
@@ -50,11 +50,11 @@ public class AsyncResponseImpl implements AsyncResponse, ContinuationCallback {
     private Continuation cont;
     private Message inMessage;
     private TimeoutHandler timeoutHandler;
-    private volatile boolean initialSuspend;
-    private volatile boolean cancelled;
-    private volatile boolean done;
-    private volatile boolean resumedByApplication;
-    private volatile Long pendingTimeout;
+    private boolean initialSuspend;
+    private boolean cancelled;
+    private boolean done;
+    private boolean resumedByApplication;
+    private Long pendingTimeout;
 
     private List<CompletionCallback> completionCallbacks = new LinkedList<CompletionCallback>();
     private List<ConnectionCallback> connectionCallbacks = new LinkedList<ConnectionCallback>();
@@ -88,7 +88,7 @@ public class AsyncResponseImpl implements AsyncResponse, ContinuationCallback {
         }
         return doResumeFinal(response);
     }
-    private boolean doResumeFinal(Object response) {
+    private synchronized boolean doResumeFinal(Object response) {
         inMessage.getExchange().put(AsyncResponse.class, this);
         cont.setObject(response);
         resumedByApplication = true;
@@ -151,7 +151,7 @@ public class AsyncResponseImpl implements AsyncResponse, ContinuationCallback {
     }
 
     @Override
-    public boolean setTimeout(long time, TimeUnit unit) throws IllegalStateException {
+    public synchronized boolean setTimeout(long time, TimeUnit unit) throws IllegalStateException {
         if (isCancelledOrNotSuspended()) {
             return false;
         }

-- 
To stop receiving notification emails like this one, please contact
sergeyb@apache.org.