Class PrioritizedParallelExecutor
java.lang.Object
net.adoptopenjdk.icedteaweb.resources.PrioritizedParallelExecutor
Executor which will execute multiple
Callables in parallel.
The callables must be sorted and have the highest priority callable as the first in list.
Executions of lower priority are canceled as soon as a higher priority result has been successfully been returned.
The final Future will complete as soon as the first callable completed successfully and all other callables
with higher priority (if any) have completed exceptionally-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate ExceptiongetFailureReason(List<Exception> exceptions) <V> Future<V> getSuccessfulResultWithHighestPriority(List<Callable<V>> callables) Executes the passed callables in parallel The callables must be sorted by priority with the highest priority as the first in list.
-
Field Details
-
LIST_PREFIX
- See Also:
-
executor
-
-
Constructor Details
-
PrioritizedParallelExecutor
Constructor- Parameters:
executor- the executor service which is used for executing the callables.
-
-
Method Details
-
getSuccessfulResultWithHighestPriority
Executes the passed callables in parallel The callables must be sorted by priority with the highest priority as the first in list. Executions of lower priority are canceled as soon as a higher priority result has successfully been calculated. The returnedFuturewill complete as soon as the first callable completed successfully and all other callables with higher priority (if any) have completed exceptionally.- Parameters:
callables- the callables to execute.- Returns:
- a future holding the best result from all callables.
-
getFailureReason
-