Skip to content

Commit

Permalink
Fixed test that was spin looping causing lots of allocations and GC p…
Browse files Browse the repository at this point in the history
…ressure.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
  • Loading branch information
sbordet committed Dec 12, 2023
1 parent f620f99 commit 8057cb3
Showing 1 changed file with 13 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -230,14 +230,20 @@ protected HttpReceiverOverHTTP newHttpReceiver()
{
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();
}
};
Expand All @@ -260,5 +266,7 @@ protected void fillInterested()
Response response = listener.get(5, TimeUnit.SECONDS);
assertNotNull(response);
assertEquals(200, response.getStatus());

Thread.sleep(2000);
}
}

0 comments on commit 8057cb3

Please sign in to comment.