@rlkoshak’s advice about Thread::sleep and executeCommandLine is spot on.
My understanding is that, out of the box, the thread pool for rules gets set to the default number of threads, which is 5. If you want to test whether that is the cause of your issue, the number of threads allocated to rule execution can be adjusted on the fly.
In conf/services/runtime.cfg
, put the following parameter and set NN to something greater than 5. The number you select will depend a lot on your hardware configuration, as well as what else is running on the box. I actually have this number set to 20 in 3 separate openHAB environments (one test box, and 2 prod boxes). I’ve been monitoring for the last several days to see if there are any bad side effects (of which have been none so far).
org.eclipse.smarthome.threadpool:ruleEngine=NN