Close active URCap threads when loading a new Installation

We have a URCap that executes a periodic communication task using ScheduledExecutorService. We have noticed that, when loading a new Installation file, this periodic task is still active, and is added to the perodic task of the newly loaded Installation.

In UI related tasks we know that it’s possible to control this through the openView() and closeView() functions, but we have not found an API function that allows us to detect when a new Installation is loaded.

Any suggestions? Thank you!

Should be able to tell when a new installation file is opened because the InstallationNode’s constructor will run. Otherwise if you have some global thread that should remain while the installation changes, you could try launching them from the Activator, as this is only ever run once.

I was looking for some function so that the instance itself could detect that the current Installation is closed, so this way I could properly shutdown my running tasks. Anyway, I’m going to take a look at your Activator idea. Thank you Eric!