Class CommonThreadPool

java.lang.Object
org.apache.sysds.runtime.util.CommonThreadPool
All Implemented Interfaces:
Executor, ExecutorService

public class CommonThreadPool extends Object implements ExecutorService
This common thread pool provides an abstraction to obtain a shared thread pool. If the number of logical cores is specified a ForkJoinPool.commonPool is returned on all requests. If pools of different size are requested, we create new pool instances of FixedThreadPool, Unless we currently are on the main thread, Then we return a shared instance of the first requested number of cores. Alternatively the class also contain a dynamic threadPool, that is intended for asynchronous long running tasks with low compute overhead, such as broadcast and collect from federated workers.
  • Field Details

    • incorrectPoolUse

      public static boolean incorrectPoolUse
      Local variable indicating if there was a thread that was not main, and requested a thread pool
  • Constructor Details

    • CommonThreadPool

      public CommonThreadPool(ExecutorService pool)
      Constructor of the threadPool. This is intended not to be used except for tests. Please use the static constructors.
      Parameters:
      pool - The thread pool instance to use.
  • Method Details