I am using Helidon WebClient to do API calls, I have struck upon a certain use case, I am pasting a demo of the use case.
var request = webClient.get()
.path("/api/users?page=2")
.request(String.class)
.thenAccept(res -> {
printThreadId("firstreq");
System.out.println(res);
var res2 = webClient.get()
.path("/api/users?page=2")
.request(String.class)
.await();
System.out.println(res2);
cf.complete(null);
});
The problem is thread is getting blocked for endless time after the res2 call.
The solution was to use thenAcceptAsync instead of thenAccept. But, I am not able to understand, why this is the case?