Am 15.09.2014 um 22:39 schrieb Martin Buchholz:
http://docs.oracle.com/javase/8/docs/api/java/util/Timer.html#schedule-java.util.TimerTask-long-

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.

Is there a reason why a TimerTask is not reset for reuse when cancelled or 
already done?

-Ulf




On Mon, Sep 15, 2014 at 10:47 AM, Ulf Zibis <ulf.zi...@cosoco.de 
<mailto:ulf.zi...@cosoco.de>> wrote:

    Hi all,

    I'm missing clarity, if a j.u.TimerTask object can be scheduled more than 
once.
    Especially, can it be scheduled again with Timer.schedule(...) after it has 
been cancelled, or
    has a new TimerTask object to be instantiated?
    What happens if a TimerTask is scheduled again before the first schedule 
had happened; would
    it then happen twice or would the same run be re-scheduled?

    Thanks,

    -Ulf



Reply via email to