Class ExecutorServiceUtils

java.lang.Object
org.komamitsu.fluency.util.ExecutorServiceUtils

public class ExecutorServiceUtils extends Object
  • Constructor Details

    • ExecutorServiceUtils

      public ExecutorServiceUtils()
  • Method Details

    • newSingleThreadDaemonExecutor

      public static ExecutorService newSingleThreadDaemonExecutor()
      Creates an Executor that is based on daemon threads. This allows the program to quit without explicitly calling shutdown on the pool
      Returns:
      the newly created single-threaded Executor
    • newScheduledDaemonThreadPool

      public static ScheduledExecutorService newScheduledDaemonThreadPool(int corePoolSize)
      Creates a scheduled thread pool where each thread has the daemon property set to true. This allows the program to quit without explicitly calling shutdown on the pool
      Parameters:
      corePoolSize - the number of threads to keep in the pool, even if they are idle
      Returns:
      a newly created scheduled thread pool
    • finishExecutorService

      public static void finishExecutorService(ExecutorService executorService)
    • finishExecutorService

      public static void finishExecutorService(ExecutorService executorService, long waitSecond)