public class ParallelConfiguration extends Object
Modifier and Type | Field and Description |
---|---|
org.spockframework.runtime.model.parallel.ExecutionMode |
defaultExecutionMode |
org.spockframework.runtime.model.parallel.ExecutionMode |
defaultSpecificationExecutionMode |
boolean |
enabled |
Constructor and Description |
---|
ParallelConfiguration() |
Modifier and Type | Method and Description |
---|---|
void |
custom(int parallelism,
int minimumRunnable,
int maxPoolSize,
int corePoolSize,
int keepAliveSeconds)
Allows fine grained custom control over the parameters of the execution.
|
void |
dynamic(BigDecimal factor)
Computes the desired parallelism based on the number of available
processors/cores multiplied by the
factor . |
void |
dynamicWithReservedProcessors(BigDecimal factor,
int reservedProcessors)
Computes the desired parallelism based on the number of available
processors multiplied by the
factor however it makes sure to keep reservedProcessors free. |
void |
fixed(int parallelism)
Uses a fixed value for
parallelism . |
org.spockframework.runtime.DefaultParallelExecutionConfiguration |
getParallelExecutionConfiguration()
Internal use only
|
public boolean enabled
public org.spockframework.runtime.model.parallel.ExecutionMode defaultSpecificationExecutionMode
public org.spockframework.runtime.model.parallel.ExecutionMode defaultExecutionMode
public void dynamic(BigDecimal factor)
factor
.factor
- to use to determine parallelismpublic void dynamicWithReservedProcessors(BigDecimal factor, int reservedProcessors)
factor
however it makes sure to keep reservedProcessors
free.
Example:
Given a configuration of dynamicWithReservedProcessors(1, 2)
On a system with 8 threads 6 threads will be used for testing.
On a system with 4 threads only 2 threads will be used for testing.
On a system with 1 or 2 threads only 1 thread will be used for testing, effectively deactivating parallel execution.
factor
- to use to determine parallelism (must be <= 1
)reservedProcessors
- the number for processors to reserve for other things (must be >= 0
)public void fixed(int parallelism)
parallelism
.parallelism
- the parallelism levelpublic void custom(int parallelism, int minimumRunnable, int maxPoolSize, int corePoolSize, int keepAliveSeconds)
parallelism
- the parallelism levelminimumRunnable
- the minimum allowed number of core
threads not blocked by a join or ManagedBlocker
. To
ensure progress, when too few unblocked threads exist and
unexecuted tasks may exist, new threads are constructed, up to
the given maximumPoolSize. For the default value, use 1
, that ensures liveness. A larger value might improve
throughput in the presence of blocked activities, but might
not, due to increased overhead. A value of zero may be
acceptable when submitted tasks cannot have dependencies
requiring additional threads.maxPoolSize
- the maximum number of threads allowed.
When the maximum is reached, attempts to replace blocked
threads fail. (However, because creation and termination of
different threads may overlap, and may be managed by the given
thread factory, this value may be transiently exceeded.) To
arrange the same value as is used by default for the common
pool, use 256
plus the parallelism
level. (By
default, the common pool allows a maximum of 256 spare
threads.) Using a value (for example Integer.MAX_VALUE
) larger than the implementation's total
thread limit has the same effect as using this limit (which is
the default).corePoolSize
- the number of threads to keep in the pool
(unless timed out after an elapsed keep-alive). Normally (and
by default) this is the same value as the parallelism level,
but may be set to a larger value to reduce dynamic overhead if
tasks regularly block. Using a smaller value (for example
0
) has the same effect as the default.keepAliveSeconds
- the elapsed time since last use before
a thread is terminated (and then later replaced if needed).public org.spockframework.runtime.DefaultParallelExecutionConfiguration getParallelExecutionConfiguration()