Class ThreadPoolUtils

java.lang.Object
io.openems.common.utils.ThreadPoolUtils

public class ThreadPoolUtils extends Object
  • Method Details

    • shutdownAndAwaitTermination

      public static void shutdownAndAwaitTermination(ExecutorService pool, int timeoutSeconds)
      Shutdown a ExecutorService.

      Source: https://docs.oracle.com/javase/7/docs/api/java/util/concurrent/ExecutorService.html

      Parameters:
      pool - the ExecutorService pool
      timeoutSeconds - the applied timeout (is applied twice in the worst case)
    • debugLog

      public static String debugLog(ThreadPoolExecutor executor)
      Creates a debug log output with key metrics of the given ThreadPoolExecutor.
      Parameters:
      executor - the executor
      Returns:
      a String
    • debugMetrics

      public static Map<String,Long> debugMetrics(ThreadPoolExecutor executor)
      Creates a map of debug metrics of the given ThreadPoolExecutor.
      Parameters:
      executor - the executor
      Returns:
      a Map of key to value