Package 

Class ExecutorUtils


  • 
    public class ExecutorUtils
    
                        

    Implements utility functions to facilitate work with Executors and ExecutorService.

    • 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 reusepreviously 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 createdas 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
    • Method Detail

      • newCachedThreadPool

         static ExecutorService newCachedThreadPool(boolean daemon, String baseName)

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

        Parameters:
        daemon - true to create the new threads as daemon threadsor false to create the new threads as user threads
        baseName - the base/prefix to use for the names of the new threadsor 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 createdas 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 threadsor false to create the new threads as user threads
        baseName - the base/prefix to use for the names of the new threadsor null to leave them with their default names