Package 

Class ExecutorUtils

  • All Implemented Interfaces:

    
    public class ExecutorUtils
    
                        

    Implements utility functions to facilitate work with Executors and ExecutorService.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Constructor Summary

      Constructors 
      Constructor Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      static ExecutorService newCachedThreadPool(boolean daemon, String baseName) Creates a thread pool that creates new threads as needed, but will reuse previously constructed threads when they are available.
      static ScheduledExecutorService newScheduledThreadPool(int corePoolSize, boolean daemon, String baseName) Creates a scheduled thread pool, Optionally, the new threads are created as daemon threads and their names are based on a specific (prefix) string.
      • Methods inherited from class java.lang.Object

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

    • Method Detail

      • newCachedThreadPool

         static ExecutorService newCachedThreadPool(boolean daemon, String baseName)

        Creates a thread pool that creates new threads as needed, but will reuse previously constructed threads when they are available. Optionally, the new threads are created as daemon threads and their names are based on a specific (prefix) string.

        Parameters:
        daemon - true to create the new threads as daemon threads or false to create the new threads as user threads
        baseName - the base/prefix to use for the names of the new threads or null to leave them with their default names
      • newScheduledThreadPool

         static ScheduledExecutorService newScheduledThreadPool(int corePoolSize, boolean daemon, String baseName)

        Creates a scheduled thread pool, Optionally, the new threads are created as daemon threads and their names are based on a specific (prefix) string.

        Parameters:
        corePoolSize - the number of threads to keep in the pool, even if they are idle.
        daemon - true to create the new threads as daemon threads or false to create the new threads as user threads
        baseName - the base/prefix to use for the names of the new threads or null to leave them with their default names