[concurrency-interest] the remove-on-cancel policy on ScheduledThreadPoolExecutor
sjlee at apache.org
Tue Aug 31 01:12:50 EDT 2010
Maybe this has been discussed in the past...
I've always been curious why ScheduledFuture.cancel() would not also remove
tasks from the queue (so would keep them live until the delay elapses) as an
optional behavior. I know one can override the decorateTask() method to
achieve the same effect, but it's slightly less than optimal as you need to
create an additional delegate object to achieve the same goal. Then I
checked the upcoming JDK 7 changes, and there seems to be such a setting
called the remove-on-cancel policy!
I looked some old versions of ScheduledThreadPoolExecutor, and it seems this
behavior was in but was removed at some point? Could someone shed light on
why it was decided not to include it in the existing versions of JDK? And
why the change in JDK 7? I would love to have this behavior, but I'm just
curious about the reason behind these decisions. Thanks!
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Concurrency-interest