Package org.testng.internal.thread
Class ThreadUtil
- java.lang.Object
-
- org.testng.internal.thread.ThreadUtil
-
public class ThreadUtil extends java.lang.ObjectA helper class to interface TestNG concurrency usage.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringTHREAD_NAME
-
Constructor Summary
Constructors Constructor Description ThreadUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.util.concurrent.ExecutorServicecreateExecutor(IConfiguration config, int threadCount, java.lang.String threadFactoryName)static java.lang.StringcurrentThreadInfo()Returns a readable name of the current executing thread.static voidexecute(IConfiguration configuration, java.lang.String name, java.util.List<? extends java.lang.Runnable> tasks, int threadPoolSize, long timeout)Parallel execution of thetasks.static booleanisTestNGThread()
-
-
-
Field Detail
-
THREAD_NAME
public static final java.lang.String THREAD_NAME
- See Also:
- Constant Field Values
-
-
Method Detail
-
isTestNGThread
public static boolean isTestNGThread()
- Returns:
- true if the current thread was created by TestNG.
-
execute
public static void execute(IConfiguration configuration, java.lang.String name, java.util.List<? extends java.lang.Runnable> tasks, int threadPoolSize, long timeout)
Parallel execution of thetasks. The startup is synchronized so this method emulates a load test.- Parameters:
tasks- the list of tasks to be runthreadPoolSize- the size of the parallel threads to be used to execute the taskstimeout- a maximum timeout to wait for tasks finalization
-
currentThreadInfo
public static java.lang.String currentThreadInfo()
Returns a readable name of the current executing thread.
-
createExecutor
public static java.util.concurrent.ExecutorService createExecutor(IConfiguration config, int threadCount, java.lang.String threadFactoryName)
-
-