code: public static ScheduledExecutorService newScheduledDaemonThreadPool(int corePoolSize) {
          return Executors.newScheduledThreadPool(corePoolSize, r -> {
              Thread t = Executors.defaultThreadFactory().newThread(r);
              t.setDaemon(true);
              return t;
          });
      }
docs: 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
  
  @param corePoolSize the number of threads to keep in the pool,
  even if they are idle
  
  @return a newly created scheduled thread pool