ScheduledExecutorService throwable lost
- by Andrey
Hello,
Consider I scheduled a Runnable for periodic execution with ScheduledExecutorService and there occurs some system Error like OutOfMemory. It will be silently swallowed.
scheduler.scheduleWithFixedDelay(new Runnable() {
@Override
public void run() {
throw new OutOfMemoryError(); // Swallowed
}
}, 0, delay, TimeUnit.SECONDS);
Is it normal?
Why doesn't it propagate to the container?
What is the correct way to handle such errors?
Thanks!