ning

How to wait for all requests to finish

陌路散爱 提交于 2019-12-12 14:30:41
问题 I am using ning AsyncHttpClient from a command line program. I need to wait for all requests to end so I can safely call close() on the client. The challenge is that I make many requests from many different parts of the program. Stripped own code below that shows one scenario where I do a nested HTTP request from the onCompleted of another request: final AsyncHttpClient asyncHttpClient = new AsyncHttpClient(); Future<Response> f1 = asyncHttpClient.prepareGet(url).execute( new