marinmitev / smarthome

Eclipse SmartHome project
Eclipse Public License 1.0
2 stars 1 forks source link

Ensure that providers are ready when importing rules #138

Closed kaikreuzer closed 8 years ago

kaikreuzer commented 8 years ago

As I understand, module type providers are added in a thread (AutomationResourceBundlesEventQueue runnable) different than the thread setRule (RuleEngine) is being called.

setRule calls ConnectionValidator which requires the providers for the rule validation process (ConnectionValidator.validateConnections). How do you make sure that providers are ready before setRule is completed?

(Mainly I refer to the case when the system starts and the rules are added via ruleRegistry.addProvider(rp);. In this case the module type providers are still not loaded).

danchom commented 8 years ago

It is fixed in PR #144. The ConnectionValidator must be call only when there are not err messages (which means that all modules have find their module types and have associated handlers)

smhgit commented 8 years ago

I tried the fix for #138 and currently it seems it doesn't solves the issue in my system. I will check it more carefully later today.

I suspect that the root cause still exists as the provider doesn't not exists when the setRule is called, and after it is loaded the setRule is not called again. But as I wrote, I will check it more carefully ...