Unlike Executor.execute(), which lets the thread's default exception handler to log anything thrown from the task, ScheduledExecutorService.schedule() expects you to get the exceptions from the returned ScheduledFuture, and will not log the exceptions.
As we want to log everything thrown from inside the executors, and don't want to check the ScheduledFuture each time we use ScheduledExecutorService, we probably need to create our own ScheduledExecutorService that logs the exceptions and avoid using the vanilla version.
Unlike
Executor.execute(), which lets the thread's default exception handler to log anything thrown from the task,ScheduledExecutorService.schedule()expects you to get the exceptions from the returnedScheduledFuture, and will not log the exceptions.As we want to log everything thrown from inside the executors, and don't want to check the
ScheduledFutureeach time we useScheduledExecutorService, we probably need to create our ownScheduledExecutorServicethat logs the exceptions and avoid using the vanilla version.