DSL reschedule anonymous timer


I need to reschedule a timer, but since it’s used in a Procedure, it would be more confortable to declare it anonymously, like this:

createTimer(now, [ |
   if (some_condition) {
   } else {

Obviously the above code fails on the reschedule(now.plusSeconds(1)) statement. Is there any way to achieve this?


No. You have to tell it what to reschedule, somehow.

The usual trick where there may be a number of similar timers is to store the handles in a ‘global’ Map,indexed by related Item name or similar.

I ended up using a List to reference all the timers inside the Procedure.