public class ThreadUtil
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
ThreadUtil.ThreadFactoryImpl |
Modifier and Type | Field and Description |
---|---|
private static java.lang.String |
THREAD_NAME |
Constructor and Description |
---|
ThreadUtil() |
Modifier and Type | Method and Description |
---|---|
static IExecutor |
createExecutor(int threadCount,
java.lang.String threadFactoryName) |
private static IThreadFactory |
createFactory(java.lang.String name) |
static java.lang.String |
currentThreadInfo()
Returns a readable name of the current executing thread.
|
static void |
execute(java.util.List<? extends java.lang.Runnable> tasks,
int threadPoolSize,
long timeout,
boolean triggerAtOnce)
Parallel execution of the
tasks . |
static boolean |
isTestNGThread() |
private static void |
log(int level,
java.lang.String msg) |
private static final java.lang.String THREAD_NAME
public static boolean isTestNGThread()
public static final void execute(java.util.List<? extends java.lang.Runnable> tasks, int threadPoolSize, long timeout, boolean triggerAtOnce)
tasks
. The startup is synchronized so this method
emulates a load test.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 finalizationtriggerAtOnce
- true if the parallel execution of tasks should be trigger at oncepublic static final java.lang.String currentThreadInfo()
public static final IExecutor createExecutor(int threadCount, java.lang.String threadFactoryName)
private static final IThreadFactory createFactory(java.lang.String name)
private static void log(int level, java.lang.String msg)