Logs execution exceptions by overriding
Reasoning is given tasks to
stops silently if there is an
Note: Task decoration is only needed to call given tasks
ScheduledExecutorService.scheduleWithFixedDelay(java.lang.Runnable, long, long, java.util.concurrent.TimeUnit)
Remove on cancel:
To prevent running into an accumulation of cancelled task which can cause gc related problems
(e.g. transactions in combination with LockResource eviction), it is best that tasks are
removed from the scheduler on cancellation.
In Java 7+ the there is a method
which removes the runnable on cancellation. Removal of tasks is done in logarithmic time
(see ScheduledThreadPoolExecutor.DelayedWorkQueue.indexOf where there is a direct lookup
instead of a linear scan over the queue). So in Java 7 we try to set this method using
reflection. In Java 7+ the manualRemoveOnCancel is ignored, since it has an efficient removal
of cancelled tasks and therefore it will always apply it. If we would wrap the task with the
RemoveOnCancelFuture, it would even prevent constant time removal.
In Java 6 there is no such method setRemoveOnCancelPolicy and therefore the task is
wrapped in a RemoveOnCancelFuture which will remove itself from the work-queue
on cancellation. However this removal isn't done in constant time, but in linear time
because Java 6 ScheduledThreadPoolExecutor doesn't support a constant time removal.
By default in Java 6, the removal of this task is done based on the 'removeOnCancel'
property which gets its value from the