You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by re...@apache.org on 2021/01/17 01:03:55 UTC

[cxf] 01/02: CXF-8394: Fix org.apache.cxf.systest.jaxrs.JAXRSContinuationsServlet3Test.testCancelVoidOnResumedTest

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

reta pushed a commit to branch 3.4.x-fixes
in repository https://gitbox.apache.org/repos/asf/cxf.git

commit 618d4f7610214d3c62f7fc300e5d2e9aa15ada34
Author: reta <dr...@gmail.com>
AuthorDate: Sat Jan 16 12:44:12 2021 -0500

    CXF-8394: Fix org.apache.cxf.systest.jaxrs.JAXRSContinuationsServlet3Test.testCancelVoidOnResumedTest
    
    (cherry picked from commit 7ac1006b3496f7e9dc8814a1ed8c683c4a50517f)
---
 .../test/java/org/apache/cxf/systest/jaxrs/AsyncResource.java | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/AsyncResource.java b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/AsyncResource.java
index 4b75774..cb7b49e 100644
--- a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/AsyncResource.java
+++ b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/AsyncResource.java
@@ -18,8 +18,9 @@
  */
 package org.apache.cxf.systest.jaxrs;
 
-import java.util.Queue;
 import java.util.concurrent.ArrayBlockingQueue;
+import java.util.concurrent.BlockingQueue;
+import java.util.concurrent.TimeUnit;
 
 import javax.ws.rs.GET;
 import javax.ws.rs.POST;
@@ -97,7 +98,7 @@ public class AsyncResource {
     }
 
     private static class AsyncResponseQueue {
-        Queue<AsyncResponse> queue = new ArrayBlockingQueue<>(1);
+        BlockingQueue<AsyncResponse> queue = new ArrayBlockingQueue<>(1);
 
         public void add(AsyncResponse asyncResponse) {
             queue.add(asyncResponse);
@@ -105,7 +106,11 @@ public class AsyncResource {
         }
 
         public AsyncResponse take() {
-            return queue.remove();
+            try {
+                return queue.poll(50, TimeUnit.MILLISECONDS);
+            } catch (InterruptedException ex) {
+                return null;
+            }
         }
 
     }