The TimerTask class has two methods which change and/or set the time
when the timer will fire. Both methods assume a timer period has been
set when the task was originally created.
setUpNextFire() is called *after* the timer has already fired, and
allows the task to be fired again for the same period as originally used.
restart() is called *before* the timer has fired, and resets the timer
so that the original period is restarted from the moment of the call,
effectively delaying the firing.
Currently, the setUpNextFire() method checks that the timer has in fact
fired, and that the period has been set before allowing the nextFireTime
to be set for a future time.
However, the restart() method makes no equivalent check, and allows the
nextFireTime to be moved forward irrespective of the state of the timer.
Surely this method needs to check that the timer has *not yet* fired
before allowing the nextFireTime to be moved forward? I am looking at a
multithreaded case right now where the timer is allowing a restart() to
occur *after* the timer has moved from state WAITING to state CALLING,
ie the timer has fired.
It seems to me that a check similar to that used in setUpNextFire()
should be present in restart(). The conditions under which it reports an
error if it should be illegally called is debatable, however.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@qpid.apache.org
For additional commands, e-mail: users-h...@qpid.apache.org