Class ForkJoinPoolHierarchicalTestExecutorService
java.lang.Object
org.junit.platform.engine.support.hierarchical.ForkJoinPoolHierarchicalTestExecutorService
- All Implemented Interfaces:
AutoCloseable,HierarchicalTestExecutorService
@API(status=EXPERIMENTAL,
since="1.3")
public class ForkJoinPoolHierarchicalTestExecutorService
extends Object
implements HierarchicalTestExecutorService
- Since:
- 1.3
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static class(package private) static class(package private) static classNested classes/interfaces inherited from interface org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutorService
HierarchicalTestExecutorService.TestTask -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionForkJoinPoolHierarchicalTestExecutorService(ConfigurationParameters configurationParameters) Create a newForkJoinPoolHierarchicalTestExecutorServicebased on the suppliedConfigurationParameters.Create a newForkJoinPoolHierarchicalTestExecutorServicebased on the suppliedParallelExecutionConfiguration. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Close this service and let it perform any required cleanup work.private static ParallelExecutionConfigurationcreateConfiguration(ConfigurationParameters configurationParameters) private ForkJoinPoolcreateForkJoinPool(ParallelExecutionConfiguration configuration) private voidexecuteNonConcurrentTasks(Deque<ForkJoinPoolHierarchicalTestExecutorService.ExclusiveTask> nonConcurrentTasks) private voidforkConcurrentTasks(List<? extends HierarchicalTestExecutorService.TestTask> tasks, Deque<ForkJoinPoolHierarchicalTestExecutorService.ExclusiveTask> nonConcurrentTasks, Deque<ForkJoinPoolHierarchicalTestExecutorService.ExclusiveTask> concurrentTasksInReverseOrder) voidinvokeAll(List<? extends HierarchicalTestExecutorService.TestTask> tasks) Invoke all supplied test tasks and block until their execution has finished.private booleanprivate voidjoinConcurrentTasksInReverseOrderToEnableWorkStealing(Deque<ForkJoinPoolHierarchicalTestExecutorService.ExclusiveTask> concurrentTasksInReverseOrder) Submit the supplied test task to be executed by this service.
-
Field Details
-
forkJoinPool
-
parallelism
private final int parallelism
-
-
Constructor Details
-
ForkJoinPoolHierarchicalTestExecutorService
Create a newForkJoinPoolHierarchicalTestExecutorServicebased on the suppliedConfigurationParameters.- See Also:
-
ForkJoinPoolHierarchicalTestExecutorService
@API(status=EXPERIMENTAL, since="1.7") public ForkJoinPoolHierarchicalTestExecutorService(ParallelExecutionConfiguration configuration) Create a newForkJoinPoolHierarchicalTestExecutorServicebased on the suppliedParallelExecutionConfiguration.- Since:
- 1.7
-
-
Method Details
-
createConfiguration
private static ParallelExecutionConfiguration createConfiguration(ConfigurationParameters configurationParameters) -
createForkJoinPool
-
submit
Description copied from interface:HierarchicalTestExecutorServiceSubmit the supplied test task to be executed by this service.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.
- Specified by:
submitin interfaceHierarchicalTestExecutorService- Parameters:
testTask- the test task to be executed- Returns:
- a future that the caller can use to wait for the task's execution to be finished
- See Also:
-
isAlreadyRunningInForkJoinPool
private boolean isAlreadyRunningInForkJoinPool() -
invokeAll
Description copied from interface:HierarchicalTestExecutorServiceInvoke all supplied test tasks and block until their execution has finished.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.
- Specified by:
invokeAllin interfaceHierarchicalTestExecutorService- Parameters:
tasks- the test tasks to be executed- See Also:
-
forkConcurrentTasks
private void forkConcurrentTasks(List<? extends HierarchicalTestExecutorService.TestTask> tasks, Deque<ForkJoinPoolHierarchicalTestExecutorService.ExclusiveTask> nonConcurrentTasks, Deque<ForkJoinPoolHierarchicalTestExecutorService.ExclusiveTask> concurrentTasksInReverseOrder) -
executeNonConcurrentTasks
private void executeNonConcurrentTasks(Deque<ForkJoinPoolHierarchicalTestExecutorService.ExclusiveTask> nonConcurrentTasks) -
joinConcurrentTasksInReverseOrderToEnableWorkStealing
private void joinConcurrentTasksInReverseOrderToEnableWorkStealing(Deque<ForkJoinPoolHierarchicalTestExecutorService.ExclusiveTask> concurrentTasksInReverseOrder) -
close
public void close()Description copied from interface:HierarchicalTestExecutorServiceClose this service and let it perform any required cleanup work.For example, thread-based implementations should usually close their thread pools in this method.
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceHierarchicalTestExecutorService
-