public class ResourcesDownloader
extends java.lang.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() |
java.util.List<java.util.concurrent.Future<ResourcesDownloader.AsynSamplerResultHolder>> |
invokeAllAndAwaitTermination(int maxConcurrentDownloads,
java.util.List<java.util.concurrent.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 java.util.List<java.util.concurrent.Future<ResourcesDownloader.AsynSamplerResultHolder>> invokeAllAndAwaitTermination(int maxConcurrentDownloads, java.util.List<java.util.concurrent.Callable<ResourcesDownloader.AsynSamplerResultHolder>> list) throws java.lang.InterruptedException
maxConcurrentDownloads
- max concurrent downloadslist
- list of resources to downloadjava.lang.InterruptedException
- when interrupted while waitingCopyright © 1998-2019 Apache Software Foundation. All Rights Reserved.