Guidance on discovery service syncronization?

I have a binding with one discovery service for the bridge and one for the devices. When you trigger the discovery they both get started up in parallel, the bridge gets discovered, which results in the bridge handler being destroyed and recreated… the same bridge handler that was running the device discovery, which is just obliterated mid-instruction…

Is there some best practice is terms of structuring these discovery services, and locking/synchronizing/deconflicting them so they’re not one giant race condition waiting to happen? It’s particularly important with dependencies, like devices that are dependent on bridges… you can’t be destroying bridge objects while device objects are trying to use them.

For now I was just going to stop handling the startScan() on the device discovery service, and chain off the bridge discovery service, but I’m wondering if there is some information I’m missing.

Hi Ted,

Might I ask you to ask questions around how to use the ESH APIs directly in the Eclipse Forum? I am trying to keep the dev related discussion over there (as long as it does not concern anything openHAB specific): https://www.eclipse.org/forums/index.php/f/271/

Thanks,
Kai

Yes, most certainly.

1 Like