In our system we use system.util.invokeAsynchronous() to run a number of state machines in a dedicated thread. At times some of the functions running in this thread can fault and stop working while the remaining functions will continue working. We have a mechanism to stop and restart the state machines and dedicated thread, but this does not always work to bring them all back to a working state. In such cases, we have found to get everything working again we get the Designer to think there are changes to the Gateway Event Scripts by opening the Gateway Event Script dialog, pressing the Apply button, and then closing the dialog. We then save and publish the Project from the Designer which will go through the Shutdown Script and then the Startup script. This typically will resolve any issues and all the state machines will function normally. We have also seen this resolve issues with Gateway Timer Scripts that have stopped responding. We would like to be able to accomplish this via scripting inside a button or a timer script so we can do this automatically when we detect this is needed without needing to have access to a Designer. Is there any way to do this? I have tried system.util.retarget() back to the same project, but it does not seem to restart the project scripts.
Thanks