Reputation: 41
I have an Android application that is currently using Retrofit library to make network requests. I have lots of parallel asynchronous requests. How can I now when all the requests are finished?
Upvotes: 0
Views: 2057
Reputation: 2859
Have a look at this post Retrofit — Synchronous and Asynchronous Requests – Asynchronous Requests which describes how to perform an HTTP call asynchronously by providing a callback.
You could use a CountDownLatch
with a set count
to wait until all invocations have finished, if you know beforehand how many calls you're going to perform.
Upvotes: 2