ScheduledExecutorService throwable lost
Posted
by
Andrey
on Stack Overflow
See other posts from Stack Overflow
or by Andrey
Published on 2011-01-12T22:38:23Z
Indexed on
2011/01/12
22:53 UTC
Read the original article
Hit count: 255
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!
© Stack Overflow or respective owner