Skip to content

Commit

Permalink
#9275 handle review comments
Browse files Browse the repository at this point in the history
Signed-off-by: Ludovic Orban <[email protected]>
  • Loading branch information
lorban committed Feb 1, 2023
1 parent eb0ae07 commit 618c3e4
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1146,17 +1146,19 @@ public boolean process(Request request, org.eclipse.jetty.server.Response respon
});

// Send two parallel requests.
client.newRequest(newURI(transport)).send(result -> {});
client.newRequest(newURI(transport)).send(result -> {});
CountDownLatch clientLatch = new CountDownLatch(2);
client.newRequest(newURI(transport)).send(result -> clientLatch.countDown());
client.newRequest(newURI(transport)).send(result -> clientLatch.countDown());

// Wait until both requests are in-flight.
await().atMost(timeoutInSeconds, TimeUnit.SECONDS).until(processCount::get, is(2));

// Stop the client while it has requests in-flight.
Assertions.assertTimeout(Duration.ofSeconds(timeoutInSeconds), () -> LifeCycle.stop(client));

// Let the server threads go.
// Let the server threads go & wait for the requests to be processed.
processLatch.countDown();
clientLatch.await(timeoutInSeconds, TimeUnit.SECONDS);
}

private record HandlerContext(Request request, org.eclipse.jetty.server.Response response, Callback callback)
Expand Down

0 comments on commit 618c3e4

Please sign in to comment.