Class GracefulScheduledExecutor

  • All Implemented Interfaces:
    java.lang.AutoCloseable

    
    public abstract class GracefulScheduledExecutor
     implements AutoCloseable
                        

    We use a GracefulScheduledExecutor because ScheduledExecutorService prevents the process from exiting.

    The Java Virtual Machine runs until all threads that are not daemon threads have died. And Executors.defaultThreadFactory() creates each new thread as a non-daemon thread. However, there is an overload of Executors.newSingleThreadScheduledExecutor(); which takes a ThreadFactory as a parameter, if you care to venture in that direction.