public class ResourcesDownloader extends Object
// list of AsynSamplerResultHolder to download
List<Callable<AsynSamplerResultHolder>> list = ...
// max parallel downloads
int maxConcurrentDownloads = ...
// get the singleton instance
ResourcesDownloader resourcesDownloader = ResourcesDownloader.getInstance();
// schedule the downloads and wait for the completion
List<Future<AsynSamplerResultHolder>> retExec = resourcesDownloader.invokeAllAndAwaitTermination(maxConcurrentDownloads, list);
the call to invokeAllAndAwaitTermination will block until the downloads complete or get interruptedModifier and Type | Class and Description |
---|---|
static class |
ResourcesDownloader.AsynSamplerResultHolder
Holder of AsynSampler result
|
Modifier and Type | Method and Description |
---|---|
static ResourcesDownloader |
getInstance() |
List<Future<ResourcesDownloader.AsynSamplerResultHolder>> |
invokeAllAndAwaitTermination(int maxConcurrentDownloads,
List<Callable<ResourcesDownloader.AsynSamplerResultHolder>> list)
This method will block until the downloads complete or it get interrupted
the Future list returned by this method only contains tasks that have been scheduled in the threadpool.
|
void |
shrink()
this method will try to shrink the thread pool size as much as possible
it should be called at the end of a test
|
public static ResourcesDownloader getInstance()
public void shrink()
public List<Future<ResourcesDownloader.AsynSamplerResultHolder>> invokeAllAndAwaitTermination(int maxConcurrentDownloads, List<Callable<ResourcesDownloader.AsynSamplerResultHolder>> list) throws InterruptedException
maxConcurrentDownloads
- max concurrent downloadslist
- list of resources to downloadInterruptedException
- when interrupted while waitingCopyright © 1998-2016 Apache Software Foundation. All Rights Reserved.