Class ConcurrencySettings
- java.lang.Object
-
- com.github.robtimus.junit.support.concurrent.ConcurrencySettings
-
public final class ConcurrencySettings extends Object
Settings to apply when callingConcurrentRunner.runConcurrently(Executable, ConcurrencySettings)
. This allows shared settings to be applied to multiple concurrent calls without having to createConcurrentRunner
instances yourself.- Author:
- Rob Spoor
- Since:
- 3.0
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
count()
Returns the number of times to run blocks of code.int
threadCount()
Returns the number of threads to use.static ConcurrencySettings
withCount(int count)
Creates a new concurrency settings object.ConcurrencySettings
withThreadCount(int threadCount)
Sets the number of threads to use.
-
-
-
Method Detail
-
withCount
public static ConcurrencySettings withCount(int count)
Creates a new concurrency settings object.- Parameters:
count
- The number of times to run blocks of code.- Returns:
- The created concurrency settings object.
- Throws:
IllegalArgumentException
- If the given count is not positive.
-
withThreadCount
public ConcurrencySettings withThreadCount(int threadCount)
Sets the number of threads to use.- Parameters:
threadCount
- The number of threads to use.- Returns:
- This object.
- Throws:
IllegalArgumentException
- If the given thread count is not at least 2.- See Also:
ConcurrentRunner.withThreadCount(int)
-
count
public int count()
Returns the number of times to run blocks of code.- Returns:
- The number of times to run blocks of code.
-
threadCount
public int threadCount()
Returns the number of threads to use.- Returns:
- The number of threads to use.
-
-