[concurrency-interest] Executors.newSingleThreadScheduledExecutor()

David Holmes dholmes at dltech.com.au
Thu Apr 7 01:31:55 EDT 2005


Hanson,

> My question is if the single thread terminates due to a failure,
> do we expect
>
> 1) a new one to take its place so the periodic command will still be
> re-scheduled and get executed ?   Or
> 2) the failure to cause a termination of the periodic execution so the
> command will not be re-scheduled ?

2) As per the docs for ScheduledThreadPoolExecutor - see scheduleAtFixedRate
and scheduledWithFixedDelay:

"If any execution of the task encounters an exception, subsequent executions
are suppressed."

The presumption is that an exception from one run of the task is likely to
preclude it being able to run in the future, so it is dropped. If a task
thinks it can tolerate exceptions then it should not let them propagate.

Cheers,
David Holmes




More information about the Concurrency-interest mailing list