Am 16.09.2014 um 00:47 schrieb Martin Buchholz:

    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 
already scheduled!

Correct!
Note: https://bugs.openjdk.java.net/browse/JDK-8058550

    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.

Interesting.

-Ulf


Reply via email to