Class DaemonExecutorService


  • public final class DaemonExecutorService
    extends Object
    A "CachedThreadPool" based on Daemon threads.

    The Threads are created as needed and once idle live for 60 seconds.

    • Constructor Detail

      • DaemonExecutorService

        public DaemonExecutorService​(int shutdownWaitSeconds,
                                     String namePrefix)
        Construct the DaemonThreadPool.
        Parameters:
        shutdownWaitSeconds - the time in seconds allowed for the pool to shutdown nicely. After this the pool is forced to shutdown.
    • Method Detail

      • execute

        public void execute​(Runnable runnable)
        Execute the Runnable.
      • shutdown

        public void shutdown()
        Shutdown this thread pool nicely if possible.

        This will wait a maximum of 20 seconds before terminating any threads still working.