Class ThreadUtil

    • Constructor Detail

      • ThreadUtil

        public ThreadUtil()
    • Method Detail

      • isTestNGThread

        public static boolean isTestNGThread()
        Returns:
        true if the current thread was created by TestNG.
      • execute

        public static void execute​(String name,
                                   List<? extends Runnable> tasks,
                                   int threadPoolSize,
                                   long timeout,
                                   boolean triggerAtOnce)
        Parallel execution of the tasks. The startup is synchronized so this method emulates a load test.
        Parameters:
        tasks - the list of tasks to be run
        threadPoolSize - the size of the parallel threads to be used to execute the tasks
        timeout - a maximum timeout to wait for tasks finalization
        triggerAtOnce - true if the parallel execution of tasks should be trigger at once
      • currentThreadInfo

        public static String currentThreadInfo()
        Returns a readable name of the current executing thread.
      • createExecutor

        public static IExecutor createExecutor​(int threadCount,
                                               String threadFactoryName)