Skip to content

ScheduledExecutorService won't log the exception if the task throws #1237

Description

@zhangkun83

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.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions