@ Beta public static ScheduledExecutorService getExitingScheduledExecutorService ( ScheduledThreadPoolExecutor executor , long terminationTimeout , TimeUnit timeUnit ) { return new Application ( ) . getExitingScheduledExecutorService ( executor , terminationTimeout , timeUnit ) ; }
Converts the given ScheduledThreadPoolExecutor into a ScheduledExecutorService that exits when the application is complete . It does so by using daemon threads and adding a shutdown hook to wait for their completion .