On 20/07/18 15:18, Kim van der Riet wrote:


On 07/20/2018 10:00 AM, Gordon Sim wrote:
On 20/07/18 14:50, Kim van der Riet wrote:
I agree that this is ambiguous. However, if the intent is to allow the timer to have period added for any state, why do we need setUpNextFire()? This idea seems logically wrong.

I believe setUpNextFire() was intended to be used by the Task subclass itself in order to repeat an action (i.e. to have a periodic task).

Agreed, but since I need to track the state of the timer using external logic / state anyway (ie only call setUpNextFire() after the fire has happened), why can't I use restart for that instead?  It does exactly the same thing, just without the check that the timer has fired.

Not really sure what you are asking.

There is setUpNextFire() which ensures that it is called after the task has fired and only if it was periodic (i.e. had a duration). Then there is restart which just causes the timer to 'restart' i.e. to fire after the desired interval starting from now has elapsed. That has no check of current state or whether task has already fired.

I thought what you wanted was a third option - a delay() - which would postpone the task to the full timeout again, but only if it had not already run. If so, that seems reasonable to me and should be easy to add. I think adding is safer than modifying one of the existing behaviours.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@qpid.apache.org
For additional commands, e-mail: users-h...@qpid.apache.org

Reply via email to