reta commented on code in PR #3697:
URL: https://github.com/apache/cxf/pull/3697#discussion_r4519151975


##########
rt/transports/http-hc5/src/test/java/org/apache/cxf/transport/http/asyncclient/hc5/SharedInputBufferTest.java:
##########
@@ -81,4 +86,35 @@ protected void waitForData(int waitPos) throws IOException {
             executor.shutdownNow();
         }
     }
+    
+    @Test
+    public void testCloseWhenDataBlockFillsBuffer() throws Exception {
+        final CountDownLatch consumerWaiting = new CountDownLatch(1);
+        final SharedInputBuffer inbuf = new SharedInputBuffer(1024);
+        final byte[] data = new byte[4096];
+
+        final Thread t = new Thread(() -> {

Review Comment:
   @ffang I borrow your idea with the thread state check, that would let us 
keep the sync inside, and also have more stable test cases. The other option I 
had was sleep + inbuf.close(), it did work as well but sleep is inherently not 
reliable. 



##########
rt/transports/http-hc5/src/test/java/org/apache/cxf/transport/http/asyncclient/hc5/SharedInputBufferTest.java:
##########
@@ -81,4 +86,35 @@ protected void waitForData(int waitPos) throws IOException {
             executor.shutdownNow();
         }
     }
+    
+    @Test
+    public void testCloseWhenDataBlockFillsBuffer() throws Exception {
+        final CountDownLatch consumerWaiting = new CountDownLatch(1);
+        final SharedInputBuffer inbuf = new SharedInputBuffer(1024);
+        final byte[] data = new byte[4096];
+
+        final Thread t = new Thread(() -> {

Review Comment:
   @ffang I borrowed your idea with the thread state check, that would let us 
keep the sync inside, and also have more stable test cases. The other option I 
had was sleep + inbuf.close(), it did work as well but sleep is inherently not 
reliable. 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to