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:15:22 UTC

[cxf] branch 3.1.x-fixes 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 3.1.x-fixes
in repository https://gitbox.apache.org/repos/asf/cxf.git


The following commit(s) were added to refs/heads/3.1.x-fixes by this push:
     new 2b7bd80  [CXF-7575] Reintroducing the sync blocks to avoid the race conditions, with thanks to John Bellassai
2b7bd80 is described below

commit 2b7bd80ba4d1d569d303b1e73c93a587b0f4cd21
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
---
 .../org/apache/cxf/jaxrs/impl/AsyncResponseImpl.java     | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 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 f4395d8..3650c04 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,12 +50,12 @@ 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>();
     private Throwable unmappedThrowable;
@@ -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.