We have a bunch of audio files that must be downloaded from a remote site and stored locally. After all the downloads have completed, we must persist data about the local files inside a db.
This routine uses a pool of threads (Guava
ListeningExecutorService) to perform in parallel the downloads. Each download is expressed as a
Future where the string, once returned, will contain data about the local file. Each download is entrusted to a thread from the pool and the corresponding
Future is added to a
If you’re still here, you may well wish to read the whole lot…