Missing clarity in TimerTask doc
martinrb at google.com
Mon Sep 15 22:47:28 UTC 2014
On Mon, Sep 15, 2014 at 3:11 PM, Ulf Zibis <Ulf.Zibis at cosoco.de> wrote:
> Am 15.09.2014 um 22:39 schrieb Martin Buchholz:
>> IllegalStateException - if task was already scheduled or cancelled, timer
>> was cancelled, or timer thread terminated.
> Oops, overseen, thanks!
> Maybe it could be extentend to:
> IllegalStateException - if task was already scheduled, cancelled or
> already done, timer was cancelled, or timer thread terminated.
> ... as I assume a TimerTask instance is never reusable.
It's already "technically correct" - if it was already done, then it was
> Is there a reason why a TimerTask is not reset for reuse when cancelled or
> already done?
It's a reasonable question. Like Futures, it's a lot easier to reason
about tasks when they atomically transition to a done state at most once.
But e.g. FutureTask has runAndReset.
More information about the core-libs-dev