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 2014/12/08 11:44:18 UTC

cxf git commit: [CXF-4817] Optional blocking of async context restarts

Repository: cxf
Updated Branches:
  refs/heads/master 0304dcbf5 -> 03cac8fec


[CXF-4817] Optional blocking of async context restarts


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

Branch: refs/heads/master
Commit: 03cac8fec6793014b2bb0244469be4f7257c2ed4
Parents: 0304dcb
Author: Sergey Beryozkin <sb...@talend.com>
Authored: Mon Dec 8 10:43:55 2014 +0000
Committer: Sergey Beryozkin <sb...@talend.com>
Committed: Mon Dec 8 10:43:55 2014 +0000

----------------------------------------------------------------------
 .../cxf/transport/http/Servlet3ContinuationProvider.java     | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/03cac8fe/rt/transports/http/src/main/java/org/apache/cxf/transport/http/Servlet3ContinuationProvider.java
----------------------------------------------------------------------
diff --git a/rt/transports/http/src/main/java/org/apache/cxf/transport/http/Servlet3ContinuationProvider.java b/rt/transports/http/src/main/java/org/apache/cxf/transport/http/Servlet3ContinuationProvider.java
index 2522913..91b0624 100644
--- a/rt/transports/http/src/main/java/org/apache/cxf/transport/http/Servlet3ContinuationProvider.java
+++ b/rt/transports/http/src/main/java/org/apache/cxf/transport/http/Servlet3ContinuationProvider.java
@@ -27,6 +27,7 @@ import javax.servlet.AsyncListener;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
+import org.apache.cxf.common.util.PropertyUtils;
 import org.apache.cxf.continuations.Continuation;
 import org.apache.cxf.continuations.ContinuationCallback;
 import org.apache.cxf.continuations.ContinuationProvider;
@@ -72,6 +73,7 @@ public class Servlet3ContinuationProvider implements ContinuationProvider {
     }
     
     public class Servlet3Continuation implements Continuation, AsyncListener {
+        private static final String BLOCK_RESTART = "org.apache.cxf.continuation.block.restart";
         AsyncContext context;
         volatile boolean isNew = true;
         volatile boolean isResumed;
@@ -79,16 +81,20 @@ public class Servlet3ContinuationProvider implements ContinuationProvider {
         volatile boolean isComplete;
         volatile Object obj;
         private ContinuationCallback callback;
+        private boolean blockRestart;
         public Servlet3Continuation() {
             req.setAttribute(AbstractHTTPDestination.CXF_CONTINUATION_MESSAGE,
                              inMessage.getExchange().getInMessage());
             callback = inMessage.getExchange().get(ContinuationCallback.class);
+            blockRestart = PropertyUtils.isTrue(inMessage.getContextualProperty(BLOCK_RESTART));
             context = req.startAsync(req, resp);
             context.addListener(this);
         }
 
         void startAsyncAgain() {
-            
+            if (blockRestart) {
+                return;
+            }
             AsyncContext old = context;
             try {
                 context = req.startAsync();