I have observed some differences between httpasyncclient 4.0-beta3 and
4.0.1 when the client is closed / shutdown and there are still pending
requests.
This can be observed by running AsyncClientHttpExchange and closing the
client while the request is not yet completed.

a) httpasyncclient-4.0-beta3.jar, httpclient-4.2.3.jar, httpcore-4.2.3.jar,
uses DefaultHttpAsyncClient implementation:
HttpAsyncClient httpclient = new DefaultHttpAsyncClient();
httpclient.start();
final HttpGet request = new HttpGet("http://www.apache.org/";);
Future<HttpResponse> future = httpclient.execute(request, myCallback);
httpclient.shutdown();    // maybe done by some other thread
HttpResponse response = future.get();

b) httpasyncclient-4.0.1.jar, httpclient-4.3.2.jar, httpcore-4.3.2.jar,
uses InternalHttpAsyncClient implementation:
CloseableHttpAsyncClient httpclient = HttpAsyncClients.createDefault();
httpclient.start();
final HttpGet request = new HttpGet("http://www.apache.org/";);
Future<HttpResponse> future = httpclient.execute(request, myCallback);
httpclient.close();      // maybe done by some other thread
HttpResponse response = future.get();

Generally it makes no sense to close the client in the same thread before
getting the response, but that might happen in our application on a
different thread.

In case a) cancelled is invoked on myCallback. In case b) cancelled is not
invoked, and the request hangs in future.get()

Is this change in the behavior expected, a bug or just some not documented
behavior in a corner case?

Regards,
Jose

Reply via email to