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/16 17:44:38 UTC

[cxf] branch master updated: 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 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 7ac1006  CXF-8394: Fix org.apache.cxf.systest.jaxrs.JAXRSContinuationsServlet3Test.testCancelVoidOnResumedTest
7ac1006 is described below

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

    CXF-8394: Fix org.apache.cxf.systest.jaxrs.JAXRSContinuationsServlet3Test.testCancelVoidOnResumedTest
---
 .../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;
+            }
         }
 
     }