If I get a ListenableFuture<X>
when calling an external system using the AsyncHttpClient
, and I call get()
immediately - will the current thread not wait until the async thread is ready with a Response? If that is true, what is the benefit of using AsyncHttpClient
?
AsyncHttpClient httpClient = new AsyncHttpClient();
ListenableFuture<Response> futureResponse = httpClient.execute(url, payload, headers);
// If this is immediately on next line, am I getting any benefit?
Response response = futureResponse.get();