I am trying to port code from using java timers to using scheduledexecutorservice
I have the following use case
class A {
public boolean execut
There is currently no good way to handle repeating tasks in the Executors framework.
It really wasn't designed with this use case in mind, and there is no realistic way to avoid swallowing exceptions.
If you really must use it for repeating tasks, each scheduling should look something like this:
scheduler.scheduleWithFixedDelay(new Runnable() {
public void run() {
try {
.. your normal code here...
} catch (Throwable t) {
// handle exceptions there
}
}
}, period, delay);