Top Description Inners Fields Constructors Methods
org.junit.platform.engine.support.hierarchical

public Class ForkJoinPoolHierarchicalTestExecutorService

extends Object
implements HierarchicalTestExecutorService
Class Inheritance
All Implemented Interfaces
org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutorService, java.lang.AutoCloseable
Annotations
@API
status:STABLE
since:1.10
Static Imports
java.util.concurrent.CompletableFuture.completedFuture, org.apiguardian.api.API.Status.STABLE, org.junit.platform.engine.support.hierarchical.ExclusiveResource.GLOBAL_READ_WRITE, .Node.ExecutionMode.CONCURRENT, .Node.ExecutionMode.SAME_THREAD

A ForkJoinPool-based executor service that executes test tasks with the configured parallelism.
Since
1.3
See Also
ForkJoinPool, DefaultParallelExecutionConfigurationStrategy

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv class
pack-priv static interface
pack-priv static class
pack-priv static class
pack-priv static class

Field Summary

Modifier and TypeField and Description
pack-priv final ForkJoinPool
private final int
private final ForkJoinPoolHierarchicalTestExecutorService.TaskEventListener
private final ThreadLocal<ForkJoinPoolHierarchicalTestExecutorService.ThreadLock>

Constructor Summary

AccessConstructor and Description
public
ForkJoinPoolHierarchicalTestExecutorService(ConfigurationParameters configurationParameters)

Create a new ForkJoinPoolHierarchicalTestExecutorService based on the supplied ConfigurationParameters.

public
ForkJoinPoolHierarchicalTestExecutorService(ParallelExecutionConfiguration configuration)

Create a new ForkJoinPoolHierarchicalTestExecutorService based on the supplied ParallelExecutionConfiguration.

pack-priv

Method Summary

Modifier and TypeMethod and Description
public void
close()

Implements org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutorService.close.

Close this service and let it perform any required cleanup work.

private static ParallelExecutionConfiguration
private ForkJoinPool
private void
private void
public void
invokeAll(List<? extends HierarchicalTestExecutorService.TestTask> tasks)

Implements org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutorService.invokeAll.

Invoke all supplied test tasks and block until their execution has finished.

private boolean
private void
private static boolean
private void
public Future<@Nullable Void>
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

forkJoinPoolback to summary
pack-priv final ForkJoinPool forkJoinPool
parallelismback to summary
private final int parallelism
taskEventListenerback to summary
private final ForkJoinPoolHierarchicalTestExecutorService.TaskEventListener taskEventListener
threadLocksback to summary
private final ThreadLocal<ForkJoinPoolHierarchicalTestExecutorService.ThreadLock> threadLocks

Constructor Detail

ForkJoinPoolHierarchicalTestExecutorServiceback to summary
public ForkJoinPoolHierarchicalTestExecutorService(ConfigurationParameters configurationParameters)

Create a new ForkJoinPoolHierarchicalTestExecutorService based on the supplied ConfigurationParameters.

See Also
DefaultParallelExecutionConfigurationStrategy
ForkJoinPoolHierarchicalTestExecutorServiceback to summary
public ForkJoinPoolHierarchicalTestExecutorService(ParallelExecutionConfiguration configuration)

Create a new ForkJoinPoolHierarchicalTestExecutorService based on the supplied ParallelExecutionConfiguration.

Annotations
@API
status:STABLE
since:1.10
Since
1.7
ForkJoinPoolHierarchicalTestExecutorServiceback to summary
pack-priv ForkJoinPoolHierarchicalTestExecutorService(ParallelExecutionConfiguration configuration, ForkJoinPoolHierarchicalTestExecutorService.TaskEventListener taskEventListener)

Method Detail

closeback to summary
public void close()

Implements org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutorService.close.

Doc from org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutorService.close.

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.

Annotations
@Override
createConfigurationback to summary
private static ParallelExecutionConfiguration createConfiguration(ConfigurationParameters configurationParameters)
createForkJoinPoolback to summary
private ForkJoinPool createForkJoinPool(ParallelExecutionConfiguration configuration)
executeSyncback to summary
private void executeSync(Deque<ForkJoinPoolHierarchicalTestExecutorService.ExclusiveTask> tasks)
forkConcurrentTasksback to summary
private void forkConcurrentTasks(List<? extends HierarchicalTestExecutorService.TestTask> tasks, Deque<ForkJoinPoolHierarchicalTestExecutorService.ExclusiveTask> isolatedTasks, Deque<ForkJoinPoolHierarchicalTestExecutorService.ExclusiveTask> sameThreadTasks, Deque<ForkJoinPoolHierarchicalTestExecutorService.ExclusiveTask> concurrentTasksInReverseOrder)
invokeAllback to summary
public void invokeAll(List<? extends HierarchicalTestExecutorService.TestTask> tasks)

Implements org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutorService.invokeAll.

Doc from org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutorService.invokeAll.

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.

Annotations
@Override
isAlreadyRunningInForkJoinPoolback to summary
private boolean isAlreadyRunningInForkJoinPool()
joinConcurrentTasksInReverseOrderToEnableWorkStealingback to summary
private void joinConcurrentTasksInReverseOrderToEnableWorkStealing(Deque<ForkJoinPoolHierarchicalTestExecutorService.ExclusiveTask> concurrentTasksInReverseOrder)
requiresGlobalReadWriteLockback to summary
private static boolean requiresGlobalReadWriteLock(HierarchicalTestExecutorService.TestTask testTask)
resubmitDeferredTasksback to summary
private void resubmitDeferredTasks()
submitback to summary
public Future<@Nullable Void> submit(HierarchicalTestExecutorService.TestTask testTask)

Implements org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutorService.submit.

Doc from org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutorService.submit.

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.

Annotations
@Override
org.junit.platform.engine.support.hierarchical back to summary

pack-priv Class ForkJoinPoolHierarchicalTestExecutorService.ExclusiveTask

extends ForkJoinTask<@Nullable Void>
Class Inheritance
Annotations
@SuppressWarnings:serial, RedundantSuppression

Field Summary

Modifier and TypeField and Description
private static final long
private final HierarchicalTestExecutorService.TestTask

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public boolean
exec()

Implements abstract java.util.concurrent.ForkJoinTask.exec.

Immediately performs the base action of this task and returns true if, upon return from this method, this task is guaranteed to have completed.

pack-priv void
public final Void

Returns:

null always
getRawResult
()

Implements abstract java.util.concurrent.ForkJoinTask.getRawResult.

Always returns null.

protected final void
setRawResult(Void mustBeNull)

Implements abstract java.util.concurrent.ForkJoinTask.setRawResult.

Requires null completion value.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.util.concurrent.ForkJoinTask:
adaptadaptadaptadaptInterruptibleadaptInterruptibleadaptInterruptiblecancelcompareAndSetForkJoinTaskTagcompletecompleteExceptionallyexceptionNowforkgetgetgetExceptiongetForkJoinTaskTaggetPoolgetQueuedTaskCountgetSurplusQueuedTaskCounthelpQuiesceinForkJoinPoolinvokeinvokeAllinvokeAllinvokeAllisCancelledisCompletedAbnormallyisCompletedNormallyisDonejoinpeekNextLocalTaskpollNextLocalTaskpollSubmissionpollTaskquietlyCompletequietlyInvokequietlyJoinquietlyJoinquietlyJoinUninterruptiblyreinitializeresultNowsetForkJoinTaskTagstatetryUnfork

Field Detail

serialVersionUIDback to summary
private static final long serialVersionUID

Hides java.util.concurrent.ForkJoinTask.serialVersionUID.

Annotations
@Serial
testTaskback to summary
private final HierarchicalTestExecutorService.TestTask testTask

Constructor Detail

ExclusiveTaskback to summary
pack-priv ExclusiveTask(HierarchicalTestExecutorService.TestTask testTask)

Method Detail

execback to summary
public boolean exec()

Implements abstract java.util.concurrent.ForkJoinTask.exec.

Doc from java.util.concurrent.ForkJoinTask.exec.

Immediately performs the base action of this task and returns true if, upon return from this method, this task is guaranteed to have completed. This method may return false otherwise, to indicate that this task is not necessarily complete (or is not known to be complete), for example in asynchronous actions that require explicit invocations of completion methods. This method may also throw an (unchecked) exception to indicate abnormal exit. This method is designed to support extensions, and should not in general be called otherwise.

Annotations
@SuppressWarnings:try
@Override
execSyncback to summary
pack-priv void execSync()
getRawResultback to summary
public final Void getRawResult()

Implements abstract java.util.concurrent.ForkJoinTask.getRawResult.

Always returns null.

Returns:Void

null always

Annotations
@Override
setRawResultback to summary
protected final void setRawResult(Void mustBeNull)

Implements abstract java.util.concurrent.ForkJoinTask.setRawResult.

Requires null completion value.

Annotations
@Override
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Annotations
@Override
org.junit.platform.engine.support.hierarchical back to summary

pack-priv Interface ForkJoinPoolHierarchicalTestExecutorService.TaskEventListener


Field Summary

Modifier and TypeField and Description
public static final ForkJoinPoolHierarchicalTestExecutorService.TaskEventListener

Method Summary

Modifier and TypeMethod and Description
public void

Field Detail

NOOPback to summary
public static final ForkJoinPoolHierarchicalTestExecutorService.TaskEventListener NOOP

Method Detail

deferredback to summary
public void deferred(HierarchicalTestExecutorService.TestTask testTask)
org.junit.platform.engine.support.hierarchical back to summary

pack-priv Class ForkJoinPoolHierarchicalTestExecutorService.ThreadLock

extends Object
Class Inheritance
  • java.lang.Object
  • org.junit.platform.engine.support.hierarchical.ForkJoinPoolHierarchicalTestExecutorService.ThreadLock

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static interface

Field Summary

Modifier and TypeField and Description
private final List<ForkJoinPoolHierarchicalTestExecutorService.ExclusiveTask>
private final Deque<ResourceLock>

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
pack-priv void
pack-priv boolean
pack-priv ForkJoinPoolHierarchicalTestExecutorService.ThreadLock.NestedResourceLock
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

deferredTasksback to summary
private final List<ForkJoinPoolHierarchicalTestExecutorService.ExclusiveTask> deferredTasks
locksback to summary
private final Deque<ResourceLock> locks

Constructor Detail

ThreadLockback to summary
pack-priv ThreadLock()

Method Detail

addDeferredTaskback to summary
pack-priv void addDeferredTask(ForkJoinPoolHierarchicalTestExecutorService.ExclusiveTask task)
areAllHeldLocksCompatibleWithback to summary
pack-priv boolean areAllHeldLocksCompatibleWith(ResourceLock lock)
withNestingback to summary
pack-priv ForkJoinPoolHierarchicalTestExecutorService.ThreadLock.NestedResourceLock withNesting(ResourceLock lock)
org.junit.platform.engine.support.hierarchical back to summary

pack-priv Interface ForkJoinPoolHierarchicalTestExecutorService.ThreadLock.NestedResourceLock

extends AutoCloseable

Method Summary

Modifier and TypeMethod and Description
public void
close()

Redeclares java.lang.AutoCloseable.close.

Closes this resource, relinquishing any underlying resources.

Method Detail

closeback to summary
public void close()

Redeclares java.lang.AutoCloseable.close.

Doc from java.lang.AutoCloseable.close.

Closes this resource, relinquishing any underlying resources. This method is invoked automatically on objects managed by the try-with-resources statement.

Annotations
@Override
org.junit.platform.engine.support.hierarchical back to summary

pack-priv Class ForkJoinPoolHierarchicalTestExecutorService.WorkerThread

extends ForkJoinWorkerThread
Class Inheritance

Constructor Summary

AccessConstructor and Description
pack-priv
WorkerThread(ForkJoinPool pool, ClassLoader contextClassLoader)

Method Summary

Inherited from java.util.concurrent.ForkJoinWorkerThread:
getPoolgetPoolIndexgetQueuedTaskCountonStartonTerminationrun

Constructor Detail

WorkerThreadback to summary
pack-priv WorkerThread(ForkJoinPool pool, ClassLoader contextClassLoader)
org.junit.platform.engine.support.hierarchical back to summary

pack-priv Class ForkJoinPoolHierarchicalTestExecutorService.WorkerThreadFactory

extends Object
implements ForkJoinWorkerThreadFactory
Class Inheritance
  • java.lang.Object
  • org.junit.platform.engine.support.hierarchical.ForkJoinPoolHierarchicalTestExecutorService.WorkerThreadFactory
All Implemented Interfaces
java.util.concurrent.ForkJoinPool.ForkJoinWorkerThreadFactory

Field Summary

Modifier and TypeField and Description
private final ClassLoader

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public ForkJoinWorkerThread
newThread(ForkJoinPool pool)

Implements java.util.concurrent.ForkJoinPool.ForkJoinWorkerThreadFactory.newThread.

Returns a new worker thread operating in the given pool.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

contextClassLoaderback to summary
private final ClassLoader contextClassLoader

Constructor Detail

WorkerThreadFactoryback to summary
pack-priv WorkerThreadFactory()

Method Detail

newThreadback to summary
public ForkJoinWorkerThread newThread(ForkJoinPool pool)

Implements java.util.concurrent.ForkJoinPool.ForkJoinWorkerThreadFactory.newThread.

Doc from java.util.concurrent.ForkJoinPool.ForkJoinWorkerThreadFactory.newThread.

Returns a new worker thread operating in the given pool. Returning null or throwing an exception may result in tasks never being executed. If this method throws an exception, it is relayed to the caller of the method (for example execute) causing attempted thread creation. If this method returns null or throws an exception, it is not retried until the next attempted creation (for example another call to execute).

Annotations
@Override