Class ForkJoinPoolHierarchicalTestExecutorService
- java.lang.Object
-
- org.junit.platform.engine.support.hierarchical.ForkJoinPoolHierarchicalTestExecutorService
-
- All Implemented Interfaces:
java.lang.AutoCloseable
,HierarchicalTestExecutorService
@API(status=EXPERIMENTAL, since="1.3") public class ForkJoinPoolHierarchicalTestExecutorService extends java.lang.Object implements HierarchicalTestExecutorService
- Since:
- 1.3
- See Also:
ForkJoinPool
,DefaultParallelExecutionConfigurationStrategy
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static class
ForkJoinPoolHierarchicalTestExecutorService.ExclusiveTask
(package private) static class
ForkJoinPoolHierarchicalTestExecutorService.WorkerThread
(package private) static class
ForkJoinPoolHierarchicalTestExecutorService.WorkerThreadFactory
-
Nested classes/interfaces inherited from interface org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutorService
HierarchicalTestExecutorService.TestTask
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.concurrent.ForkJoinPool
forkJoinPool
private int
parallelism
-
Constructor Summary
Constructors Constructor Description ForkJoinPoolHierarchicalTestExecutorService(ConfigurationParameters configurationParameters)
Create a newForkJoinPoolHierarchicalTestExecutorService
based on the suppliedConfigurationParameters
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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.
-
-
-
Constructor Detail
-
ForkJoinPoolHierarchicalTestExecutorService
public ForkJoinPoolHierarchicalTestExecutorService(ConfigurationParameters configurationParameters)
Create a newForkJoinPoolHierarchicalTestExecutorService
based on the suppliedConfigurationParameters
.
-
-
Method Detail
-
createForkJoinPool
private java.util.concurrent.ForkJoinPool createForkJoinPool(ConfigurationParameters configurationParameters)
-
submit
public java.util.concurrent.Future<java.lang.Void> submit(HierarchicalTestExecutorService.TestTask testTask)
Description copied from interface:HierarchicalTestExecutorService
Submit 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:
submit
in 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:
HierarchicalTestExecutorService.invokeAll(List)
-
isAlreadyRunningInForkJoinPool
private boolean isAlreadyRunningInForkJoinPool()
-
invokeAll
public void invokeAll(java.util.List<? extends HierarchicalTestExecutorService.TestTask> tasks)
Description copied from interface:HierarchicalTestExecutorService
Invoke 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:
invokeAll
in interfaceHierarchicalTestExecutorService
- Parameters:
tasks
- the test tasks to be executed- See Also:
HierarchicalTestExecutorService.submit(TestTask)
-
forkConcurrentTasks
private void forkConcurrentTasks(java.util.List<? extends HierarchicalTestExecutorService.TestTask> tasks, java.util.Deque<ForkJoinPoolHierarchicalTestExecutorService.ExclusiveTask> nonConcurrentTasks, java.util.Deque<ForkJoinPoolHierarchicalTestExecutorService.ExclusiveTask> concurrentTasksInReverseOrder)
-
executeNonConcurrentTasks
private void executeNonConcurrentTasks(java.util.Deque<ForkJoinPoolHierarchicalTestExecutorService.ExclusiveTask> nonConcurrentTasks)
-
joinConcurrentTasksInReverseOrderToEnableWorkStealing
private void joinConcurrentTasksInReverseOrderToEnableWorkStealing(java.util.Deque<ForkJoinPoolHierarchicalTestExecutorService.ExclusiveTask> concurrentTasksInReverseOrder)
-
close
public void close()
Description copied from interface:HierarchicalTestExecutorService
Close 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:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfaceHierarchicalTestExecutorService
-
-