Class TaskRunner<T>

java.lang.Object
edu.cmu.tetrad.util.TaskRunner<T>
Type Parameters:
T - the type of the result of the tasks

public class TaskRunner<T> extends Object
This class is for running a list of tasks that implement Callable.

Feb 23, 2024 8:41:11 PM

Author:
Kevin V. Bui (kvb2univpitt@gmail.com)
  • Constructor Summary

    Constructors
    Constructor
    Description
    This class is responsible for running a list of tasks that implement the Callable interface in parallel using multiple threads.
    TaskRunner(int numOfThreads)
    Initializes a TaskRunner with the specified number of threads.
  • Method Summary

    Modifier and Type
    Method
    Description
    run(List<Callable<T>> tasks)
    Executes a list of tasks that implement Callable in parallel using multiple threads.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • TaskRunner

      public TaskRunner()
      This class is responsible for running a list of tasks that implement the Callable interface in parallel using multiple threads.
    • TaskRunner

      public TaskRunner(int numOfThreads)
      Initializes a TaskRunner with the specified number of threads.
      Parameters:
      numOfThreads - the number of threads to be used by the TaskRunner
  • Method Details

    • run

      public List<T> run(List<Callable<T>> tasks)
      Executes a list of tasks that implement Callable in parallel using multiple threads.
      Parameters:
      tasks - the list of tasks to execute
      Returns:
      a list of results from the completed tasks