Pass a closure to runIn

The runIn method is scheduling things behind the scenes, our scheduling of smart apps all just take a method name to be called at the scheduled time. That means when this executes it is a new “run” of the smart app.

For a closure to be executed like you are showing we would need to keep a reference to that closure which depending on how long that runIn is for means holding way too many references in memory and that the execution would need to happen inside the same JVM which isn’t as resilient as being able to make a new call to a smart app method.

7 Likes