Cleaning up the startup process / renaming rules (windows possible)

could somebody explain to me what is going on here?
how does this work and what does it do?

From my guessing it is like this:

On startup different things are done. Bindings are started, rules are loaded. You can see everything with its startup level by doing

bundle:list

For me it outputs stuff like:

 ID │ State    │ Lvl │ Version                │ Name
────┼──────────┼─────┼────────────────────────┼───────────────────────────────────────────
[...]
129 │ Active   │  80 │ 0.10.0.oh240           │ Eclipse SmartHome Item Model
130 │ Active   │  80 │ 0.10.0.oh240           │ Eclipse SmartHome Item Model IDE
131 │ Active   │  80 │ 0.10.0.oh240           │ Eclipse SmartHome Item Model Runtime
[...]
160 │ Active   │  80 │ 2.14.0.v20180522-1629  │ Xbase Runtime Library
175 │ Active   │  80 │ 1.9.6                  │ MIME streaming extension
177 │ Active   │  80 │ 6.2.0                  │ org.objectweb.asm
178 │ Active   │  80 │ 6.2.0                  │ org.objectweb.asm.commons
179 │ Active   │  80 │ 6.2.0                  │ org.objectweb.asm.tree
180 │ Active   │  90 │ 2.4.0                  │ openHAB Core
181 │ Active   │  80 │ 2.4.0                  │ openHAB Karaf Integration
183 │ Resolved │  80 │ 2.4.0                  │ openHAB Sound Support, Hosts: 116
184 │ Active   │  80 │ 2.4.0                  │ openHAB Dashboard UI
[...]

There you can see most things have a level of 80, including bindings. Without the above change, rules also have a startup level of 80:

bundle:start-level org.eclipse.smarthome.model.rule
Level 80

What I assume is that everything with the same startup level is started at the same time. So when the startup level reaches 80, everything with startup level 80 is loaded at the same time. By increasing the level of rules, rules are loaded after everything in startup level 80 (like things or bindings) are loaded. Effectively delaying rule loading after everything else is loaded.


I even got a step further by loading things, items, etc. step by step by doing:

bundle:start-level org.eclipse.smarthome.model.thing 83
bundle:start-level org.eclipse.smarthome.model.thing.ide  83
bundle:start-level org.eclipse.smarthome.model.thing.runtime   83
bundle:start-level org.eclipse.smarthome.model.item 85
bundle:start-level org.eclipse.smarthome.model.item.ide 85
bundle:start-level org.eclipse.smarthome.model.item.runtime 85
bundle:start-level org.eclipse.smarthome.model.sitemap   88
bundle:start-level org.eclipse.smarthome.model.sitemap.ide    88
bundle:start-level org.eclipse.smarthome.model.sitemap.runtime     88
bundle:start-level org.eclipse.smarthome.model.rule 90
bundle:start-level org.eclipse.smarthome.model.rule.ide 90
bundle:start-level org.eclipse.smarthome.model.rule.runtime 90

So first things are loaded (after everything else in level 80 like bindings), then items, then sitemaps and finally rules. I’d guess they depend on each other in this order (e.g. items need things and sitemaps need items etc.).

This is just my guessing - I didn’t take a look at the code or so. If somebody from the devs could confirm this I’d be grateful.

2 Likes