Class ExecutorServiceUtils


  • public class ExecutorServiceUtils
    extends java.lang.Object
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void finishExecutorService​(java.util.concurrent.ExecutorService executorService)  
      static void finishExecutorService​(java.util.concurrent.ExecutorService executorService, long waitSecond)  
      static java.util.concurrent.ScheduledExecutorService newScheduledDaemonThreadPool​(int corePoolSize)
      Creates a scheduled thread pool where each thread has the daemon property set to true.
      static java.util.concurrent.ExecutorService newSingleThreadDaemonExecutor()
      Creates an Executor that is based on daemon threads.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ExecutorServiceUtils

        public ExecutorServiceUtils()
    • Method Detail

      • newSingleThreadDaemonExecutor

        public static java.util.concurrent.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 java.util.concurrent.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​(java.util.concurrent.ExecutorService executorService)
      • finishExecutorService

        public static void finishExecutorService​(java.util.concurrent.ExecutorService executorService,
                                                 long waitSecond)