@API(status=EXPERIMENTAL, since="1.3") public class ForkJoinPoolHierarchicalTestExecutorService extends java.lang.Object implements HierarchicalTestExecutorService
ForkJoinPool
-based
executor service that executes
test tasks with the configured parallelism.ForkJoinPool
,
DefaultParallelExecutionConfigurationStrategy
Modifier and Type | Class and Description |
---|---|
(package private) static class |
ForkJoinPoolHierarchicalTestExecutorService.ExclusiveTask |
(package private) static class |
ForkJoinPoolHierarchicalTestExecutorService.WorkerThread |
(package private) static class |
ForkJoinPoolHierarchicalTestExecutorService.WorkerThreadFactory |
HierarchicalTestExecutorService.TestTask
Modifier and Type | Field and Description |
---|---|
private java.util.concurrent.ForkJoinPool |
forkJoinPool |
private int |
parallelism |
Constructor and Description |
---|
ForkJoinPoolHierarchicalTestExecutorService(ConfigurationParameters configurationParameters)
Create a new
ForkJoinPoolHierarchicalTestExecutorService based on
the supplied ConfigurationParameters . |
Modifier and Type | Method and Description |
---|---|
void |
close()
Close this service and let it perform any required cleanup work.
|
private java.util.concurrent.ForkJoinPool |
createForkJoinPool(ConfigurationParameters configurationParameters) |
private void |
executeNonConcurrentTasks(java.util.Deque<ForkJoinPoolHierarchicalTestExecutorService.ExclusiveTask> nonConcurrentTasks) |
private void |
forkConcurrentTasks(java.util.List<? extends HierarchicalTestExecutorService.TestTask> tasks,
java.util.Deque<ForkJoinPoolHierarchicalTestExecutorService.ExclusiveTask> nonConcurrentTasks,
java.util.Deque<ForkJoinPoolHierarchicalTestExecutorService.ExclusiveTask> concurrentTasksInReverseOrder) |
void |
invokeAll(java.util.List<? extends HierarchicalTestExecutorService.TestTask> tasks)
Invoke all supplied test tasks and block until
their execution has finished.
|
private boolean |
isAlreadyRunningInForkJoinPool() |
private void |
joinConcurrentTasksInReverseOrderToEnableWorkStealing(java.util.Deque<ForkJoinPoolHierarchicalTestExecutorService.ExclusiveTask> concurrentTasksInReverseOrder) |
java.util.concurrent.Future<java.lang.Void> |
submit(HierarchicalTestExecutorService.TestTask testTask)
Submit the supplied test task to be executed by
this service.
|
private final java.util.concurrent.ForkJoinPool forkJoinPool
private final int parallelism
public ForkJoinPoolHierarchicalTestExecutorService(ConfigurationParameters configurationParameters)
ForkJoinPoolHierarchicalTestExecutorService
based on
the supplied ConfigurationParameters
.private java.util.concurrent.ForkJoinPool createForkJoinPool(ConfigurationParameters configurationParameters)
public java.util.concurrent.Future<java.lang.Void> submit(HierarchicalTestExecutorService.TestTask testTask)
HierarchicalTestExecutorService
Implementations may execute the task asynchronously as long as its execution mode is concurrent.
Implementations must generally acquire and release the task's resource lock before and after its execution unless they execute all tests in the same thread which upholds the same guarantees.
submit
in interface HierarchicalTestExecutorService
testTask
- the test task to be executedHierarchicalTestExecutorService.invokeAll(List)
private boolean isAlreadyRunningInForkJoinPool()
public void invokeAll(java.util.List<? extends HierarchicalTestExecutorService.TestTask> tasks)
HierarchicalTestExecutorService
Implementations may execute one or multiple of the supplied tasks in parallel as long as their execution mode is concurrent.
Implementations must generally acquire and release each task's resource lock before and after its execution unless they execute all tests in the same thread which upholds the same guarantees.
invokeAll
in interface HierarchicalTestExecutorService
tasks
- the test tasks to be executedHierarchicalTestExecutorService.submit(TestTask)
private void forkConcurrentTasks(java.util.List<? extends HierarchicalTestExecutorService.TestTask> tasks, java.util.Deque<ForkJoinPoolHierarchicalTestExecutorService.ExclusiveTask> nonConcurrentTasks, java.util.Deque<ForkJoinPoolHierarchicalTestExecutorService.ExclusiveTask> concurrentTasksInReverseOrder)
private void executeNonConcurrentTasks(java.util.Deque<ForkJoinPoolHierarchicalTestExecutorService.ExclusiveTask> nonConcurrentTasks)
private void joinConcurrentTasksInReverseOrderToEnableWorkStealing(java.util.Deque<ForkJoinPoolHierarchicalTestExecutorService.ExclusiveTask> concurrentTasksInReverseOrder)
public void close()
HierarchicalTestExecutorService
For example, thread-based implementations should usually close their thread pools in this method.
close
in interface java.lang.AutoCloseable
close
in interface HierarchicalTestExecutorService