From 8057cb30ba4b78c5079b8da9bd98712d1584c44f Mon Sep 17 00:00:00 2001 From: Simone Bordet Date: Tue, 12 Dec 2023 20:19:44 +0100 Subject: [PATCH] Fixed test that was spin looping causing lots of allocations and GC pressure. Signed-off-by: Simone Bordet --- .../client/http/HttpReceiverOverHTTPTest.java | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/jetty-client/src/test/java/org/eclipse/jetty/client/http/HttpReceiverOverHTTPTest.java b/jetty-client/src/test/java/org/eclipse/jetty/client/http/HttpReceiverOverHTTPTest.java index 608a29e9bd6..f70a105a234 100644 --- a/jetty-client/src/test/java/org/eclipse/jetty/client/http/HttpReceiverOverHTTPTest.java +++ b/jetty-client/src/test/java/org/eclipse/jetty/client/http/HttpReceiverOverHTTPTest.java @@ -230,14 +230,20 @@ public class HttpReceiverOverHTTPTest { return new HttpReceiverOverHTTP(this) { + private boolean once = true; + @Override protected void fillInterested() { - // Verify that the buffer has been released - // before fillInterested() is called. - assertNull(getResponseBuffer()); - // Fill the endpoint so receive is called again. - endPoint.addInput("X"); + if (once) + { + once = false; + // Verify that the buffer has been released + // before fillInterested() is called. + assertNull(getResponseBuffer()); + // Fill the endpoint so receive is called again. + endPoint.addInput("X"); + } super.fillInterested(); } }; @@ -260,5 +266,7 @@ public class HttpReceiverOverHTTPTest Response response = listener.get(5, TimeUnit.SECONDS); assertNotNull(response); assertEquals(200, response.getStatus()); + + Thread.sleep(2000); } }